Hello guys!
I'm using pgcli to connect to AWS RDS and constantly switching accounts. Currently I'm using pgcli 4.4.0. My flow looks like this (basically it's just simple shell one-command):
# for production:
❯ export PRODPGPASSWORD=$(aws rds generate-db-auth-token --hostname $PRODRDS --port 5432 --username $PRODUSER); pgcli "host=$PRODRDS port=5432 dbname=$DBNAME user=$PRODUSER password=$PRODPGPASSWORD"
# for development:
❯ export PGPASSWORD=$(aws rds generate-db-auth-token --hostname $DEVRDS --port 5432 --username $DEVUSER); pgcli "host=$DEVRDS port=5432 dbname=$DBNAME user=$DEVUSER password=$PGPASSWORD"
So, after thorough investigation, I caught that I need to unset $PGPASSWORD before connecting to my Database, so pgcli will use <password> from the DSN URI.
Is it an intentional design of the pgcli, or just a minor inconvenience?