cccjxq
Last Updated: February 25, 2016
·
180
· dcadenas
Avatar

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

Say Thanks
Respond

1 Response
Add your response

21224
11256385 776242189162274 760080147 n

Awesome \m/

over 1 year ago ·