We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently we are able to map environment variables to configuration structs via tag.
An example:
type Config struct { DefaultPort int `env:"default_port"` }
This gets internally prefixed with COUPER_ and uppercased. The value of COUPER_DEFAULT_PORT will be assigned to Config.DefaultPort.
COUPER_
COUPER_DEFAULT_PORT
Config.DefaultPort
The following example is not possible at this moment but should:
type Config struct { DefaultPort int `env:"default_port"` Timings Timings } Type Timings struct { Timeout time.Duration `env:"timeout"` }
Env COUPER_TIMEOUT must be assigned to Config.Timings.Timeout.
COUPER_TIMEOUT
Config.Timings.Timeout
Related files are config/env/env.go and runtime/http.go makes use of it.
config/env/env.go
runtime/http.go
The text was updated successfully, but these errors were encountered:
Hey @malud ,
Can I take this up as a hacktoberfest task?
Sorry, something went wrong.
Sure. Go for it.
Since we are calling our env mapping function for related structs directly this is not a requirement anymore.
No branches or pull requests
Currently we are able to map environment variables to configuration structs via tag.
An example:
This gets internally prefixed with
COUPER_
and uppercased. The value ofCOUPER_DEFAULT_PORT
will be assigned toConfig.DefaultPort
.The following example is not possible at this moment but should:
Env
COUPER_TIMEOUT
must be assigned toConfig.Timings.Timeout
.Related files are
config/env/env.go
andruntime/http.go
makes use of it.The text was updated successfully, but these errors were encountered: