-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying config values as environment variables #80
Conversation
- added tests - moved AutomaticEnv() call into the init() function of the server flag so it's set when we run the tests. Before it was in main(). - Set SetTypeByDefaultValue to true so boolean flags can be specified as env vars.
|
||
// Configure viper to accept env vars prefixed with ATLANTIS_ that can be | ||
// used instead of flags. | ||
s.Viper.SetEnvPrefix("ATLANTIS") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@psalaberria002 I moved this in here so that I could test this functionality. I liked it better in main.go
but the tests don't run through there so this is a compromise.
s.Viper.SetEnvPrefix("ATLANTIS") | ||
s.Viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) | ||
s.Viper.AutomaticEnv() | ||
s.Viper.SetTypeByDefaultValue(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benefits of testing! Without this you can't set a boolean flag as an env var, ex. ATLANTIS_ALLOW_FORK_PRS=true
won't work without this.
Codecov Report
@@ Coverage Diff @@
## master #80 +/- ##
=======================================
Coverage 64.09% 64.09%
=======================================
Files 40 40
Lines 1916 1916
=======================================
Hits 1228 1228
Misses 626 626
Partials 62 62
Continue to review full report at Codecov.
|
Awesome |
runatlantis#80) * adding atlantis bootstrap mode to support getting started with atlantis for first time users * removed unwanted confirm variable * vendoring dependencies * more vendoring * more more and more vendoring * comment about bootstrap package * Proposed changes (runatlantis#84) * reviewed all the comments * removing required approval flag since we will default to false
Fixes #38.
Builds off the great work by @psalaberria002 in #77.