-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I'd like to specify environment variables when invoking PluginRPC plugins. Currently the environment is always empty:
Lines 94 to 95 in ad1c581
| // We want to make sure the command has access to no env vars, as the default is the current env. | |
| cmd.Env = emptyEnv |
I propose to add a ClientOption (or ExecRunnerOption or CallOption, not sure) that accepts a []string of the form "key=value", to match exec.Cmd.Env and os.Environ() format.
So something like:
func ClientWithEnviron(envs []string) ClientOption {
return func(clientOptions *clientOptions) {
clientOptions.envs = envs
}
}My use case: I write plugins that depend on (cloud providers') Go SDKs. These SDKs usually configure themselves through environment variables, among other ways. I want my plugins to feel intuitive by behaving like other tools and respecting these environment variables.
I guess it is possible to work around that limitation by passing environment variables as part of the plugin request, and then call os.Setenv() from the plugin. But that doesn't feel right.