From f2bd02c4362a46d19954f7ac2f6f30de59ef8770 Mon Sep 17 00:00:00 2001 From: ccremer Date: Thu, 22 Sep 2022 11:44:48 +0200 Subject: [PATCH] Fix env parsing if prefix is set to empty --- main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 0847b89..1f50f94 100644 --- a/main.go +++ b/main.go @@ -24,8 +24,9 @@ var ( appLongName = "a generic bootstrapping project" // TODO: Adjust or clear env var prefix - // envPrefix is the global prefix to use for the keys in environment variables - envPrefix = "BOOTSTRAP" + // envPrefix is the global prefix to use for the keys in environment variables. + // Include a delimiter like `_` if required. + envPrefix = "BOOTSTRAP_" ) func main() { @@ -96,7 +97,7 @@ func rootAction(hasSubcommands bool) func(context *cli.Context) error { // env combines envPrefix with given suffix delimited by underscore. func env(suffix string) string { - return envPrefix + "_" + suffix + return envPrefix + suffix } // envVars combines envPrefix with each given suffix delimited by underscore.