TIL how to null out or unset an ENVIRONMENT variable in bash
01 Nov 2013Heroku compiles your app without environment variables. This is all well and good, but how do you debug a problem that only shows up when an environment variable is missing? Not just set to an empty string ""
.
To do this bash has a great feature called --unset
to remove an environment variable. For example if you wanted to run rake assets:precompile
without the DATABASE_URL from your environment you could run:
$ env --unset=DATABASE_URL rake assets:precompile
This allows you to simulate missing any environment variables you want!