Closed kudla closed 9 months ago
@kudla not sure I understand. What exactly do you want to do ? You can define flag values in a file and have urfave/cli read from there. You can set the ZZZFlag.FilePath
&cli.StringFlag{
Name: "some-flag",
EnvVars: []string{"FLAG_ENV"},
},
Similar to the way we explicitly provide args into the app
app.Run([]string{"command", "--some-flag", "some-value"})
Could we inject into the app env variables set to be parsed (e.g. FLAG_ENV=some-value
) instead of implicit read form os.Environ
I.e. could app be ran in kind of virtual sandbox (args + envs) regardless OS level setup for the process.
@kudla Yes you can use values from files https://cli.urfave.org/v2/examples/flags/#values-from-files . If you dont want to pass them through the outer sandbox environment but still pass them to the flag your app can do os.Setenv(name, value) and let the flag pick it up that way
Hi Similar to how command args are provided controlled into Run call how to inject custom environment setup instead of using OS provided?
Thx.