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

Better ergonomics for passing through environment variables #213

Open
johnbatty opened this issue Mar 2, 2022 · 2 comments
Open

Better ergonomics for passing through environment variables #213

johnbatty opened this issue Mar 2, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@johnbatty
Copy link

I would like to propose an enhancement to floki to more easily allow existing environment variables to be passed through from the invoking environment to the floki docker container.

I have increasingly been coming across situations which require authentication, where credentials are typically provided via env vars. I therefore want to make it easy to pass these env vars through from a developer's environment into a floki container.

This is currently possible via docker_switches:

docker_switches:
- -e
- MY_REPO_PASSWORD
- -e
- MY_PAT_TOKEN
...etc

However, this is a bit clunky, particularly if you want to pass multiple variables. It is also potentially non-trivial to update this list with automated tools if you want to add/remove entries.

I therefore propose adding a new key env, which simply takes a list of environment variable names to pass through. This would be expanded internally to a series of -e <env_var_name> parameters for the docker run invocation. Example:

env:
- MY_REPO_PASSWORD
- MY_PAT_TOKEN
...etc

Thoughts?

I'm happy to make the code changes if we can agree that this is a desirable feature.

@johnbatty
Copy link
Author

Richard just suggested that if we do decide to add this, then floki should check that the specified variables exist, and fail with a helpful error if they don't. I agree.

@maxdymond maxdymond added the enhancement New feature or request label Jun 6, 2022
@maxdymond
Copy link
Collaborator

I think this is a desirable feature - it does somewhat break of the contract of being able to run floki files regardless of environment but the feature already exists with docker_switches and is already being actively used like that.

There's potentially a larger question around "do we want a better defined system of passing secrets into floki in the first place" - but for now I don't see any reason to block a change like this.

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