Skip to content

Instantly share code, notes, and snippets.

@xjunior
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xjunior/b0914dc504476f96b25a to your computer and use it in GitHub Desktop.
Save xjunior/b0914dc504476f96b25a to your computer and use it in GitHub Desktop.
#!/bin/bash
config_list() {
config_list=$(mktemp -t configlist)
show_value=false
longest_line=10
[ "$1" == "-v" ] && show_value=true && shift
args=("$@")
for appi in "${!args[@]}"; do
if $show_value; then
heroku config --app ${args[$appi]} | sort
else
heroku config --app ${args[$appi]} | cut -d ':' -f 1 | sort
fi > $config_list.$appi
curr_longest=$(cat $config_list.$appi | awk '{ print length }' | sort -n | tail -1)
[ "$curr_longest" -gt "$longest_line" ] && longest_line="$curr_longest"
done
pr -w $(($longest_line * 2)) -m -t $config_list.*
rm $config_list.*
}
config_list $*
$ compare-config -v app1 app1-staging
=== app1 Config Vars === app1-staging Config Vars
MMYSQL_DATABASE: mysql://staging-user:password@host.com MMYSQL_DATABASE: mysql://staging-user:password@host.com
FEATURE_ENABLED: false FEATURE_ENABLED: true
SERVICE_KEY_ID: AKI43DW4XFD16JONFE2Q SERVICE_KEY_ID: IKD9ON2T999KIAIDK1XA
SERVICE_ACCESS_KEY: DFS1PGC9eICquUZjiid9sKZC9123 SERVICE_ACCESS_KEY: DFSPGC9e4ICquUZjiid9sKZC9123
$ compare-config app1 app1-staging
=== app1 Config Vars === app1-staging Config Vars
MMYSQL_DATABASE MMYSQL_DATABASE
FEATURE_ENABLED FEATURE_ENABLED
SERVICE_KEY_ID SERVICE_KEY_ID
SERVICE_ACCESS_KEY SERVICE_ACCESS_KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment