소스 검색

[zsh] Clean up merge issue

Colin Powell 1 년 전
부모
커밋
7f1e0478a3
1개의 변경된 파일34개의 추가작업 그리고 9개의 파일을 삭제
  1. 34 9
      zsh/.zshrc

+ 34 - 9
zsh/.zshrc

@@ -21,26 +21,37 @@ alias pull="git pull --rebase --autostash"
 alias push="git push"
 alias asso="aws sso login --profile $argv"
 
-repogo() {
+yayup () {
+  mv ~/.asdf ~/.asdf.bak
+  yay -S --noconfirm archlinux-keyring endeavouros-keyring
+  yay -Syu --noconfirm
+  mv ~/.asdf.bak ~/.asdf
+}
+
+repo_go() {
+  asso registries-read
   export PRIVATE_REPO_TOKEN="$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
   export CODEARTIFACT_AUTH_TOKEN="$PRIVATE_REPO_TOKEN"
   poetry config http-basic.codeartifact aws $PRIVATE_REPO_TOKEN
   aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile registries-read
 }
 
-kush() {
+sush() {
   if [[ $1 == "sbx" ]]
   then
+    asso sure-inc
     aws eks update-kubeconfig --name surepreme-sandbox-main-cluster --profile sure-inc
   fi
 
   if [[ $1 == "qa" ]]
   then
+    asso np-farmers
     aws eks update-kubeconfig --name farmers-qa-main-cluster --profile np-farmers
-  fi 
+  fi
 
-  if [[ $1 == "prod" ]] 
+  if [[ $1 == "prod" ]]
   then
+    asso sure-inc
     echo "from platform_core.apps.core_protections.models import *" | pbcopy
     aws eks update-kubeconfig --name surepreme-production-main-cluster --profile sure-inc
     kubectl exec -it -n bastion $(kubectl get po -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- python manage.py shell
@@ -61,11 +72,25 @@ kush() {
   fi
 }
 
-yayup () {
-  mv ~/.asdf ~/.asdf.bak
-  yay -S --noconfirm archlinux-keyring endeavouros-keyring
-  yay -Syu --noconfirm
-  mv ~/.asdf.bak ~/.asdf
+alias qa="sush qa"
+alias sbx="sush sbx"
+alias prod="sush prod"
+
+prep_pg_for_sure() {
+    psql -U sure postgres -c "CREATE USER sure SUPERUSER"
+    psql -U sure postgres -c "CREATE USER surepremeroot SUPERUSER"
+    psql -U sure postgres -c "CREATE USER rdsadmin SUPERUSER"
+}
+refresh_sure_db() {
+    echo "This will likely take about 10 minutes"
+    asso np-farmers
+	aws s3 cp --profile np-farmers s3://farmers-qa-rds-exports/pg_dumps/farmers_latest.pgdump /tmp/qa_farmers_latest.pgdump
+    dropdb -U sure surepreme
+    createdb -U sure surepreme
+    psql -U sure surepreme -c "CREATE EXTENSION postgis"
+    pg_restore -d surepreme /tmp/qa_farmers_latest.pgdump
+    rm /tmp/qa_farmers_latest.pgdump
+    echo "Database `surepreme` successfully restores from QA data"
 }
 
 [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh