Skip to content
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

Add support for environment variables in the config #201

Closed
saschathiergart opened this issue Feb 21, 2019 · 5 comments
Closed

Add support for environment variables in the config #201

saschathiergart opened this issue Feb 21, 2019 · 5 comments
Assignees
Labels
Milestone

Comments

@saschathiergart
Copy link

For containerizing gobetween, it would be useful to be able to use placeholders, or environment variables in the configuration file, e.g. like this:

srv_lookup_server = "${SOME_ENV}"

@nuttysquirrel
Copy link

For me, it would be useful to be able to say;
./gobetween --config blah.toml --var 'srv_lookup_server = 1.1.1.1'
because I have multiple copies of a config file with different srv_lookup_server settings.

@illarion illarion added this to the 0.8.0 milestone Apr 5, 2019
@illarion illarion self-assigned this Apr 12, 2019
@illarion illarion removed their assignment Apr 12, 2019
@yyyar yyyar self-assigned this May 26, 2019
@yyyar
Copy link
Owner

yyyar commented May 28, 2019

Added possibility to use env vars substitution in config files. By default it's turned off.
To enable this functionality gobetween should be run with '-e' or '--use-config-env-vars':

Example:
BIND=0.0.0.0:1234 gobetween -e -c "/path/to/config.toml"

In this case all ${BIND} placeholders within config would be replaced with 0.0.0.0:1234.

@yyyar
Copy link
Owner

yyyar commented May 28, 2019

@nuttysquirrel you can now do the same with env vars, i.e.:

in config:

....
   srv_lookup_server = "${SRV_LOOKUP_SERVER}"
....

and then

SRV_LOOKUP_SERVER=1.1.1.1 ./gobetween --use-config-env-vars --config blah.toml

Would it work for you?

We'll merge this feature in develop shortly and then it would be available in next release.

@saschathiergart
Copy link
Author

Awesome!

@yyyar
Copy link
Owner

yyyar commented May 28, 2019

Also, added doc to wiki page: https://github.com/yyyar/gobetween/wiki/Configuration#using-env-vars-substitution-in-config-file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants