-
Notifications
You must be signed in to change notification settings - Fork 619
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 configuration via env vars #43
Comments
The command line flags you've found belong to the demo server which I use for demonstration and testing. The only command line flags in fabio are in https://github.com/eBay/fabio/blob/master/main.go#L30-L32 Which values would you like to configure via environment variables? |
Oh shoot, didn't double check my work on the go, you are quite right, thanks! I think the most important flags are the addresses and secrets:
Since these can all change between machines/deploys with the rest of the config the same. Also I would find Having these as flags would follow the pattern of Consul, Vault, and the other Hashicorp tools. Then envconsul (or my Solaris SMF) could be used to easily monitor and deliver the flags. |
|
Thanks! I'm looking at spf13/viper, it looks relatively straightforward to support env vars, flags, and config files. |
Good news! Viper is able to load the Java properties config with minimal changes 1. Working on the flags and env vars now. |
Thanks. I'll have a look. AFAIK, viper is using my properties library to load them :) Usually, I try not to add additional libraries for simple tasks and would prefer to have a better idea about what is being submitted before the pull request arrives. Could you explain how the property values are overridden with the ENV vars and what changes are required? Might be a good idea to add a Since I'm also the author of the properties library I was thinking about adding a generic ENV var overrides to the lib later. General idea is to normalize the name of the keys by replacing dots with underscores and have a configurable prefix, e.g. |
Your change looks simple enough so I'm curious what the delta is. One comment about the vendoring approach. Please use |
Every parameter from the configuration file can now be configured with a corresponding environment variable. The dots have to be replaced with underscores to cause less issues with certain shells. Environment variables take precedence over the configuration file. Since the runtime configuration can now be configured through multiple mechanisms the final runtime configurtion is written to the log during startup.
I've decided to implement it myself since I was working on a refactoring for issue #12 which required somewhat more control over the configuration. Adding the env var support was a trivial change there and I've pulled it into a separate commit. If this works then I'll merge it. Please have a look. All config parameters can be configured via env vars by replacing the dots with underscores. So |
Every parameter from the configuration file can now be configured with a corresponding environment variable. The dots have to be replaced with underscores to cause less issues with certain shells. Environment variables take precedence over the configuration file. Since the runtime configuration can now be configured through multiple mechanisms the final runtime configurtion is written to the log during startup.
Every parameter from the configuration file can now be configured with a corresponding environment variable. The dots have to be replaced with underscores to cause less issues with certain shells. Environment variables take precedence over the configuration file. Since the runtime configuration can now be configured through multiple mechanisms the final runtime configurtion is written to the log during startup.
Every parameter from the configuration file can now be configured with a corresponding environment variable. The dots have to be replaced with underscores to cause less issues with certain shells. Environment variables take precedence over the configuration file. Since the runtime configuration can now be configured through multiple mechanisms the final runtime configurtion is written to the log during startup.
merged. closing. |
Every parameter from the configuration file can now be configured with a corresponding environment variable. The dots have to be replaced with underscores to cause less issues with certain shells. Environment variables take precedence over the configuration file. Since the runtime configuration can now be configured through multiple mechanisms the final runtime configurtion is written to the log during startup.
Every parameter from the configuration file can now be configured with a corresponding environment variable. The dots have to be replaced with underscores to cause less issues with certain shells. Environment variables take precedence over the configuration file. Since the runtime configuration can now be configured through multiple mechanisms the final runtime configurtion is written to the log during startup.
Is this defined anywhere in the docs? I couldn't find it there |
You're probably right. I'll have a look and add it next week if it's missing.
Frank Schröder
… On 1. Apr 2017, at 21:33, Armando Magalhães ***@***.***> wrote:
Is this defined anywhere in the docs? I couldn't find it there
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Since fabio is designed to be near-zero configuration, I assumed there must be a way to set (at least the main) options with environment variables. So I went looking, and there is! Multiple command line flags are available: -addr, -consul, -name, -prefix, -proto, -token 1. However, these are not documented in the binary (in --help) or in the fabio docs.
I am happy to write the docs but wanted to leave a note here until then, if anyone else is looking for the same thing.
The text was updated successfully, but these errors were encountered: