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

Support environment variable configuration #11

Open
jessepeterson opened this issue Jun 2, 2021 · 3 comments
Open

Support environment variable configuration #11

jessepeterson opened this issue Jun 2, 2021 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jessepeterson
Copy link
Member

Currently we just use CLI flag parsing. Support configuring via environment variable fallback.

@jessepeterson jessepeterson added good first issue Good for newcomers enhancement New feature or request labels Jun 2, 2021
@steviec
Copy link
Contributor

steviec commented Jun 30, 2022

@jessepeterson, I'll take this on, it would be helpful for my setup. Should I follow the same pattern I see in mysqlscepserver using envString() and envBool()?

@sduc
Copy link

sduc commented Jan 30, 2025

@jessepeterson, It would be useful for our usecase to have the cli flags as env variables, like it is for example done on the SCEP server. Happy to take this if this is still something you guys are happy to have.

@jessepeterson
Copy link
Member Author

jessepeterson commented Jan 30, 2025

I'm not opposed @sduc! I'd want to keep it extremely lightweight, keeping the stdlib flag package (such as the simple environment readers that @steviec suggested, with some improvements). There's also a wrinkle with multiple-use switches, in particular the -storage and related functions which have a custom flag accumulator:

cliStorage := cli.NewStorage()
flag.Var(&cliStorage.Storage, "storage", "name of storage backend")
flag.Var(&cliStorage.DSN, "storage-dsn", "data source name (e.g. connection string or path)")
flag.Var(&cliStorage.DSN, "dsn", "data source name; deprecated: use -storage-dsn")
flag.Var(&cliStorage.Options, "storage-options", "storage backend options")

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

No branches or pull requests

3 participants