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

Make composite environment variable name optional #83

Closed
ilyakaznacheev opened this issue May 26, 2021 · 1 comment · Fixed by #84
Closed

Make composite environment variable name optional #83

ilyakaznacheev opened this issue May 26, 2021 · 1 comment · Fixed by #84
Assignees
Labels
feature New feature or request

Comments

@ilyakaznacheev
Copy link

There are some cases when you can't change the environment variable name to the desired format.

For example, Heroku provides a PORT environment variable for you, you can't change the name.

But with the current library implementation, I can't structure my config files like I want to. Example:

type Config struct {
    Server ConfigServer `yaml:"server"`
}

type ConfigServer struct {
    Host string `yaml:"host"`
    Port string `yaml:"port" env:"PORT"`
}

The variable name library is looking for will be SERVER_PORT, not PORT, and I can't change that without restructuring my config structure (and config files!).

Please provide an option to turn off automatically provided env prefixes, to enable exact env names.

@cristaloleg
Copy link
Member

cristaloleg commented May 26, 2021

(discussed on priv)
I will add param to env, so it will looks like: env:"NAME,exact" which means that exactly this name will be mapped on to this field.

and There will be an option to skip name (env:"-") in child fields.

@cristaloleg cristaloleg self-assigned this May 26, 2021
@cristaloleg cristaloleg mentioned this issue May 26, 2021
@cristaloleg cristaloleg mentioned this issue May 26, 2021
@cristaloleg cristaloleg added the feature New feature or request label Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants