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

Add a startup mode that enables using env variables instead of CLI arguments #26

Closed
nektro opened this issue Mar 4, 2019 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@nektro
Copy link
Owner

nektro commented Mar 4, 2019

No description provided.

@nektro nektro added the enhancement New feature or request label Mar 4, 2019
@riptl
Copy link

riptl commented Mar 4, 2019

I did this with cobra + viper in od-database-crawler, maybe it helps.

It supports config via yaml, json, flags and environment.

e.g. --output.log = {"output": {"log": "value"}} = $OD_OUTPUT_LOG

@nektro
Copy link
Owner Author

nektro commented Mar 4, 2019

So, this issue was created in order to help enable #27, however they can be used separately. I could add a function that was similar to the following (I'll see if this is what viper does)

func getProp(name string) {
    if args.Has(name) { return args.Get(name); }
    if env.Has(name) { return env.Get(name); }
    return default;
}

@riptl
Copy link

riptl commented Mar 4, 2019

@nektro Viper is a key-value storage. If it doesn't find anything in-memory, it'll look in environment.
So it essentially does the same, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants