2c1540d350217eb3a94fa38d1eef67012e57079a

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Add arg count guards to dpsql

Diff

 1diff --git a/dot_config/zsh/functions/dpsql b/dot_config/zsh/functions/dpsql
 2index 2082141472b5255c9f208282a072d2dae5dc8fbb..4c12055591e57cbafe5c0ced9bb8969a08559158 100644
 3--- a/dot_config/zsh/functions/dpsql
 4+++ b/dot_config/zsh/functions/dpsql
 5@@ -1,6 +1,11 @@
 6 # vim: ft=zsh
 7 # connect to dune RDS instance
 8 
 9+if (( $# < 2 )); then
10+  echo "usage: dpsql <env> <db> [pgcli options...]" >&2
11+  return 1
12+fi
13+
14 env=${1}
15 db=${2}
16 shift 2
17diff --git a/dot_config/zsh/functions/dpsqluri b/dot_config/zsh/functions/dpsqluri
18index f37b2d107a02812565b4eef136f313dda0cc3d67..1da9999e63d57bc7b3ab1daf9be29a8904791403 100644
19--- a/dot_config/zsh/functions/dpsqluri
20+++ b/dot_config/zsh/functions/dpsqluri
21@@ -1,5 +1,10 @@
22 # vim: ft=zsh
23 # connect to dune RDS instance
24 
25+if (( $# < 2 )); then
26+  echo "usage: dpsqluri <env> <db>" >&2
27+  return 1
28+fi
29+
30 PGPASSWORD=$(aws secretsmanager get-secret-value --secret-id ${1}_${2}_db_${2}_user_password --output text --query SecretString)
31 echo "postgres://${2}:${PGPASSWORD}@${1}-${2}-db.ayu-decibel.ts.net/${2}"