Skip to content

Commit

Permalink
add message to avoid typing in file passphrase
Browse files Browse the repository at this point in the history
  • Loading branch information
maidul98 committed Jan 6, 2023
1 parent 0d8e104 commit 7152e16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/packages/cmd/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func init() {
secretsCmd.AddCommand(secretsGetCmd)
secretsCmd.AddCommand(secretsSetCmd)
secretsCmd.AddCommand(secretsDeleteCmd)
secretsCmd.PersistentFlags().String("env", "dev", "Used to define the environment name on which actions should be taken on")
secretsCmd.PersistentFlags().String("env", "dev", "Used to select the environment name on which actions should be taken on")
secretsCmd.Flags().Bool("expand", true, "Parse shell parameter expansions in your secrets")
secretsCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
util.RequireLogin()
Expand Down
4 changes: 3 additions & 1 deletion cli/packages/util/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ func GetKeyRing() (keyring.Keyring, error) {
}

func fileKeyringPassphrasePrompt(prompt string) (string, error) {
fmt.Println("You may set the `INFISICAL_VAULT_FILE_PASSPHRASE` environment variable to avoid typing password")
if password, ok := os.LookupEnv("INFISICAL_VAULT_FILE_PASSPHRASE"); ok {
return password, nil
}

fmt.Fprintf(os.Stderr, "%s: ", prompt)
fmt.Fprintf(os.Stderr, "%s:", prompt)
b, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return "", err
}
fmt.Println("")
return string(b), nil
}

0 comments on commit 7152e16

Please sign in to comment.