HELMFILE_ENVIRONMENT variable (#1425)

Co-authored-by: Pawel Przeszlo <pawel.przeszlo@comarch.pl>
This commit is contained in:
Pawel Przeszlo 2020-08-29 06:10:07 +02:00 committed by GitHub
parent 7b11ce851a
commit 6b4b76e2bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -420,6 +420,9 @@ GLOBAL OPTIONS:
--interactive, -i Request confirmation before attempting to modify clusters --interactive, -i Request confirmation before attempting to modify clusters
--help, -h show help --help, -h show help
--version, -v print the version --version, -v print the version
Environment variables:
HELMFILE_ENVIRONMENT specify the environment name, the command line option '-e' have precedence
``` ```
### sync ### sync

View File

@ -681,7 +681,10 @@ func (c configImpl) Logger() *zap.SugaredLogger {
func (c configImpl) Env() string { func (c configImpl) Env() string {
env := c.c.GlobalString("environment") env := c.c.GlobalString("environment")
if env == "" { if env == "" {
env = state.DefaultEnv env = os.Getenv("HELMFILE_ENVIRONMENT")
if env == "" {
env = state.DefaultEnv
}
} }
return env return env
} }