Skip to content

Instantly share code, notes, and snippets.

@jaredcwhite
Created June 17, 2021 23:22
Show Gist options
  • Save jaredcwhite/95271eacaf6a6bac2225959dab162e70 to your computer and use it in GitHub Desktop.
Save jaredcwhite/95271eacaf6a6bac2225959dab162e70 to your computer and use it in GitHub Desktop.
Switch RAILS_ENV based on the presence of a dot file
load-rails-env() {
if [ -f ".rails_env" ]; then
export RAILS_ENV=$(cat .rails_env)
else
export RAILS_ENV=production
fi
}
add-zsh-hook chpwd load-rails-env
load-rails-env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment