Last Updated: February 25, 2016
·
311
· dcadenas

Find the ENV vars you forgot to add in your heroku config

This little script greps your Rails codebase looking for ENV occurences and compares it to the output of heroku config telling you which ENV var is missing remotely.

#!/bin/bash

echo "These ENV variables only exist in the rails app but not in the heroku config"
echo

envs_in_rails() {
  git grep "ENV\[" | sed "s/.*ENV\[['\"]\(.*\)['\"]\].*/\1/" | sort | uniq
}

envs_in_heroku() {
  heroku config | sed "s/^\([A-Z][^:]*\):.*/\1/" | sort | uniq
}

comm -23 <(envs_in_rails) <(envs_in_heroku)

gist

1 Response
Add your response

Awesome \m/

over 1 year ago ·