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

Don't use dots in environment variables #39

Open
tomzo opened this issue Apr 30, 2019 · 5 comments
Open

Don't use dots in environment variables #39

tomzo opened this issue Apr 30, 2019 · 5 comments

Comments

@tomzo
Copy link
Member

@tomzo tomzo commented Apr 30, 2019

Most environment variables currently are in form of GOCD_CLI.VALUE. This is very inconvenient for unix shells where . is simply not allowed in environment variable name.
This leads to bad user experience:

$ export GOCDCLI_AUTH.TYPE=basic
bash: export: `GOCDCLI_AUTH.TYPE=basic': not a valid identifier

It would suffice to use underscores, e.g. GOCDCLI_AUTH_TYPE

@marques-work
Copy link
Collaborator

@marques-work marques-work commented May 2, 2019

@tomzo hmm, this is a built-in feature of spf13/viper, which we are using to help manage configuration. We might need to build our own support to change this behavior.

@marques-work
Copy link
Collaborator

@marques-work marques-work commented May 2, 2019

@tomzo
Copy link
Member Author

@tomzo tomzo commented May 3, 2019

@arvindsv
Copy link

@arvindsv arvindsv commented May 3, 2019

They have some docs about using environment variables: https://github.com/spf13/viper#working-with-environment-variables

I don't know enough about this to know if it's relevant.

@marques-work
Copy link
Collaborator

@marques-work marques-work commented May 3, 2019

@tomzo Unfortunately, that's not an exported member, so we cannot set it; I didn't see a setter for it anywhere, but I may have missed it.

@arvindsv I think you can use BindEnv() to associate custom keys with settings. That could probably work also. I was really hoping that the StringReplacer would let us specify how env variable names are calculated and thus get env variable support for free with no further maintenance. But we'll see how that works out :)

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

Successfully merging a pull request may close this issue.

None yet
3 participants