From 48c0e342e3e5ffc8f75c686407a71a7b6980d83d Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 23 Jul 2024 15:21:14 -0300 Subject: [PATCH] only look for private key in environment variable if --sec is not given. --- helpers.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/helpers.go b/helpers.go index d7832e7..830fe7f 100644 --- a/helpers.go +++ b/helpers.go @@ -196,10 +196,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 + + // check in the environment for the secret key + if sec == "" { + if key, ok := os.LookupEnv("NOSTR_PRIVATE_KEY"); ok { + sec = key + } } if c.Bool("prompt-sec") {