Working between Python environments, Node.js servers, and command line access to PostgreSQL allows us to be nimble and productive, but it also means that it can be really easy to get your environmental variables crossed. Luckily, there's an easy way to check what your terminal's variables are:
Here's the Linux Man page.
If you don't already know this trick, you're going to be so, so happy you learned it today.
Open up your terminal and type
env. It will likely spit out quite a few environmental variables at you, especially if you recently
My giant list of variables, redacted about as much as the Mueller Report:
One of the ways I use
env most frequently is to double check that I'm connected to my local database before connecting to PostgreSQL in my terminal to ensure I'm not altering our staging or production databases:
env | grep PGHOST
This command filters through the results of
env to show what you're actually searching for; in my case, that's that PGHOST is set to localhost and not a hosted endpoint.