add message to avoid typing in file passphrase

This commit is contained in:
Maidul Islam
2023-01-06 01:30:08 -05:00
parent 0d8e1042ba
commit 7152e16288
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -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
}