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

Make it easier to ignore/allow specific environment variables #92

Open
michaelherold opened this issue Aug 27, 2020 · 1 comment
Open

Comments

@michaelherold
Copy link

As far as I can tell, the only way to ignore an environment variable within dip is to add it to the DIP_EARLY_ENV environment variable. This is a reasonable heuristic for what to ignore, but it means that there is an order-dependence to your shell configuration.

What I found is that since I use chruby, which modifies the GEM_HOME and GEM_PATH environment variables, my dip-run containers were not picking up the bundle in my Docker volume and were thus not working.

The reason for that is that my eval "$(dip console)" was being run prior to chruby initializing.

It would be really nice if dip had the ability to allowlist/denylist environment variables to use within the containers. Something like:

environment:
  allowed:
    - BUNDLE_GITHUB__COM
    - RAILS_MASTER_KEY

or

environment:
  denied:
    - GEM_HOME
    - GEM_PATH

I'd be happy to take a crack at an approach if you want.


Aside

I'm not really sure what the current behavior is meant for since docker-compose already handles the environment variables that I need within my project. Why do you pass all environment variables in, instead of relying on docker-compose to manage the environment for you?

@bibendi
Copy link
Owner

bibendi commented Aug 28, 2020

Hi Michael!

Why do you pass all environment variables

The main goal is to do not think about all environment variables that may appear in a project, e.g. VERSION=20200421 rails db:migrate:down and many others.

eval "$(dip console)" was being run prior to chruby initializing

I think the workaround is to move chruby under dip in your bashrc.

It would be really nice if dip had the ability to allowlist/denylist environment variables

I need some time to think about what can I do with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants