-
Notifications
You must be signed in to change notification settings - Fork 211
Configuration
- Configuration location
- Configuration format
- Using ENV vars substitution in config file
- Passing arguments in ENV variable
(since v0.3.0)
There are several options where gobetween could pull it's configuration on startup.
$ gobetween from-file /path/to/gobetween.toml
$ gobetween from-url http://some.url/gobetween.toml
$ gobetween from-consul localhost:8500 --key=gobetween --scheme=http -f json
gobetween could be configured with TOML or JSON (these formats map 1-to-1 to each other). You can specify format with --format (-f) option, for exaple:
$ gobetween from-url http://some.url/gobetween.toml -f toml
$ gobetween from-url http://some.url/gobetween.json -f json
(since v0.8.0)
You can enable replacing env vars placeholders ${...}
in config file to env variables values pasing '-e'
or '--use-config-env-vars'
flags to gobetween.
For example, having in config:
...
srv_lookup_server = "${SRV_LOOKUP_SERVER}"
...
And run command:
SRV_LOOKUP_SERVER=1.1.1.1 ./gobetween --use-config-env-vars --config blah.toml
${SRV_LOOKUP_SERVER}
would be substituted with 1.1.1.1
It's possible to pass command-line args via GOBETWEEN environment variable (containing json array of arguments) instead as typical args. It may be useful for containerization when you store application parameters in env and don't want to change command line.
So instead
$ gobetween from-url http://some.url/gobetween.toml -f toml
You can use the following syntax:
$ GOBETWEEN='["from-url", "http://some.url/gobetween.toml", "-f", "toml"]'
$ gobetween