Allow setting private key via ENV variable

This commit is contained in:
jeremyd 2024-06-27 00:22:01 -07:00 committed by fiatjaf_
parent 9f62d4679f
commit ec2e214c02

View File

@ -195,7 +195,13 @@ func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (
})
return "", bunker, err
}
// Check in the Env for the secret key first
sec := c.String("sec")
if env, ok := os.LookupEnv("NOSTR_PRIVATE_KEY"); ok {
sec = env
}
if c.Bool("prompt-sec") {
if isPiped() {
return "", nil, fmt.Errorf("can't prompt for a secret key when processing data from a pipe, try again without --prompt-sec")