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

Comments

Projects
None yet
3 participants
@tomzo
Copy link
Contributor

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

This comment has been minimized.

Copy link
Collaborator

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

This comment has been minimized.

Copy link
Collaborator

commented May 2, 2019

@tomzo

This comment has been minimized.

Copy link
Contributor Author

commented May 3, 2019

@arvindsv

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Collaborator

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
You can’t perform that action at this time.