You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using environment variables to connect via ssh #1433
I am a bit late to this (2 years and half)... but I am not sure I understand what you have in mind:
DB_URL as a set environment variable that you can ssh into.
Given the name, I suppose that DB_URL is not the name of the remote host you ssh into, is it? Also, is the .env file on your computer, or on the remote host (that you ssh into)? A more detailed usage example would help.
I've been bad and haven't prioritising a contribution to this project despite my initial enthusiasm. However, I still do love this project and use it daily.
Just for completeness and answering your question. The idea is that if you have an .env file in your project (local machine), we have a flag to parse the .env file for a variable DB_URL and we connect to this.
.env
DB_URL=...
To be honest, I've been getting by using (using fish as an example):
pgcli $(grep'DB_URL'< .env|set s/DB_URI=//)
So, I totally understand if you close this issue as totally not worth it.
Ok, got it. I was confused because of the mention of ssh, but it's actually independent. Your comment made that clearer, thanks!
For the record, I do something very similar to what you do with grep. You're right that reading from a .env* file could be more user-friendly, obviously. We would have to look for DATABASE_URL, DB_URL, variants with URI... and maybe other common names? And hope that the format is consistent. :)
I'll let this issue open. Contributions are most welcome! ;)
Activity
j-bennet commentedon Oct 28, 2023
@shivan-s Certainly, feel free to contribute! I believe adding
python-dotenvto the requirements and callingload_dotenvwould do it.shivan-s commentedon Oct 29, 2023
Great thank you!
dbaty commentedon May 31, 2026
I am a bit late to this (2 years and half)... but I am not sure I understand what you have in mind:
Given the name, I suppose that
DB_URLis not the name of the remote host you ssh into, is it? Also, is the.envfile on your computer, or on the remote host (that you ssh into)? A more detailed usage example would help.shivan-s commentedon May 31, 2026
Hi @dbaty, hope you are well.
I've been bad and haven't prioritising a contribution to this project despite my initial enthusiasm. However, I still do love this project and use it daily.
Just for completeness and answering your question. The idea is that if you have an
.envfile in your project (local machine), we have a flag to parse the.envfile for a variableDB_URLand we connect to this.To be honest, I've been getting by using (using fish as an example):
So, I totally understand if you close this issue as totally not worth it.
dbaty commentedon Jun 1, 2026
Ok, got it. I was confused because of the mention of ssh, but it's actually independent. Your comment made that clearer, thanks!
For the record, I do something very similar to what you do with
grep. You're right that reading from a.env*file could be more user-friendly, obviously. We would have to look forDATABASE_URL,DB_URL, variants withURI... and maybe other common names? And hope that the format is consistent. :)I'll let this issue open. Contributions are most welcome! ;)