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

Allow for config instead of ENV #7

Closed
hoshsadiq opened this issue Jan 28, 2018 · 3 comments
Closed

Allow for config instead of ENV #7

hoshsadiq opened this issue Jan 28, 2018 · 3 comments

Comments

@hoshsadiq
Copy link
Contributor

Having everything in ENV variables is very muddying and even our bashrc/zshrc becomes very muddy. It would be nice to be able to read config from a yaml file. Since this is go, it shouldn't be hard or slow to parse a YAML file that reads all the information.

@jtyr
Copy link
Owner

jtyr commented Jan 28, 2018

Thanks or your suggestion. You can always create a file with all the env variables and source that file in your .bashrc file. For now I have no intention to support any other configuration.

@jtyr jtyr closed this as completed Jan 28, 2018
@hoshsadiq
Copy link
Contributor Author

My point was that it muddies the environment, typing env will give you a million variables. Imo these are unnecessary. If I were to raise a PR, would it be accepted (providing you're happy with the implementation)?

@jtyr
Copy link
Owner

jtyr commented Jan 29, 2018

I'm personally not convinced that such feature is useful but if you are going to invest your time to implement it, I'm wiling to merge it if it fulfills the following criteria:

  1. It must support multiple config files which will override each others variables in the order the files are specified on the command line.
  2. Variables from the config file are merged with env vars the way that env vars have always the highest priority.
  3. Use TOML as the configuration format.

Example:

$ export GBT_CAR_DIR_PRECISSION=9999
$ cat /path/to/file1
# Global variables
separator = ""
# Dir car variables
[dir]
fg = "yellow"
$ cat /path/to/file2
# Dir car variables
[dir]
fg = "red"
depth = 3
$ gbt --config /path/to/file1 --config /path/to/file2

As a result of the above, the Dir car will end up with red foreground and depth of 9999.

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

No branches or pull requests

2 participants