Make it easier to ignore/allow specific environment variables
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?
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.