-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Change behavior of flag arguments specified as env vars #2539
Comments
Thoughts: it seems that Python developers have a rather handy function
I think this mechanism will suit most of the cases. The current possible ways to implement a flag (before #2619) are:
I propose that we can have in the future:
I'm aware of the fact that for CLI flags there is a separate issue #1649, so first I'd like to focus on the possibility of using the |
Please complete the following tasks
Describe your use case
I have a little CLI app that I also execute as a CronJob in Kubernetes. For this I used Helm to set up templates and "values files" which in turn generate the required Kubernetes manifests.
The little Clap CLI I've cfeated is called like this:
Now when I set up the Kubernetes CronJob values file I prefer to do it the Twelve-Factor App way, specifying the options and arguments as environment variables instead (which might differ between staging/production etc).
It works well for arguments and parameters. But for flags it feels a bit awkward, having to comment out the environment variable from the
values.yaml
files (there's one with base settings, one for prod env, one for staging env).So currently it looks like this:
As you can see I have to comment out
LOAD_SOURCE_CACHE: ""
in the base and staging values files. (The base and the prod/staging file are merged together)Example
main.rs
which shows current behavior:Example output with 3.0.0-beta.2:
Describe the solution you'd like
What I would like to be able to specify in the files instead is:
I.e. the value set for the "flag env var" should be specified with:
Any other value would be ignored (maybe empty value would mean
false
).Alternatives, if applicable
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: