From ed6d9b4b8346bd390006921d2c65ece3243749a9 Mon Sep 17 00:00:00 2001 From: James Patrick Date: Wed, 11 Dec 2019 20:30:02 +0000 Subject: [PATCH] Added devx helper functions. --- zsh/environment/host/devX/zshrc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 zsh/environment/host/devX/zshrc diff --git a/zsh/environment/host/devX/zshrc b/zsh/environment/host/devX/zshrc new file mode 100644 index 0000000..7877659 --- /dev/null +++ b/zsh/environment/host/devX/zshrc @@ -0,0 +1,33 @@ +##### Aliases +# Database Connection +db_envs=(cadev ildev indev ladev txdev utdev mddev) +for env in $db_envs ; do + eval "alias psql_$env='psql -d $env -h dev.cpmixkhfrend.us-east-1.rds.amazonaws.com -p 5432 -U ${env}_owner'" + if (( $+commands[pgcli] )); then + eval "alias pg_${env}='pgcli -d $env -h dev.cpmixkhfrend.us-east-1.rds.amazonaws.com -p 5432 -U ${env}_owner'" + fi +done + +alias pg_latest='pgcli -d latest -h dev.cpmixkhfrend.us-east-1.rds.amazonaws.com -p 5432 -U ladev_owner' +alias pg_csdev='pgcli -d csdev -h dev.cpmixkhfrend.us-east-1.rds.amazonaws.com -p 5432 -U cadev_owner' +alias pg_cademo='pgcli -h dev.cpmixkhfrend.us-east-1.rds.amazonaws.com -p 5432 -U "cademo_owner" -d "cademo"' +alias psql_latest='psql -d latest -h dev.cpmixkhfrend.us-east-1.rds.amazonaws.com -p 5432 -U ladev_owner' + +# List Databases +alias psql_l="psql -h dev.cpmixkhfrend.us-east-1.rds.amazonaws.com -p 5432 -U greenfiling -l" +# Sign-In as limited super user. +alias psql_root="psql -d postgres -h dev.cpmixkhfrend.us-east-1.rds.amazonaws.com -p 5432 -U greenfiling" + +##### Conveniences +############################################################################################################# + +export build_dir="/opt/build" +export apps_dir="/mount/data0/apps" + +for build_path in $build_dir/^shared ; do + # get the env name from the full path. + local env_name=$(basename $build_path ) + eval "export ${env_name}_build=${build_path}" + eval "export ${env_name}_app=${apps_dir}/${env_name}" + eval "export ${env_name}_logs=${apps_dir}/${env_name}/logs" +done