From ec2e214c02343806ef0cda7d835fe3f1f07f4693 Mon Sep 17 00:00:00 2001 From: jeremyd Date: Thu, 27 Jun 2024 00:22:01 -0700 Subject: [PATCH] Allow setting private key via ENV variable --- helpers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helpers.go b/helpers.go index a761503..d7832e7 100644 --- a/helpers.go +++ b/helpers.go @@ -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")