Hello,
I’m having problems connecting to my live database hosted on Fly.
Locally, I can connect to a database by first doing fly proxy
, and then using the following connection string as required by Npgsql
"DefaultConnection": "Host=localhost;Database=db;Username=username;Password=pw"
But with the live API and live DB, I don’t think I can use localhost
as a hostname, because they’re hosted on different containers so don’t share the same localhost right?
It’s here that I’m stuck. I have a fly secret that provides the connection string. When I change localhost to my database name, I get An error occurred using the connection to database 'postgres' on server ''.
I try to connect to it using pgAdmin without success. I think I must use a fly proxy
to connect to it through localhost, but it seems odd to me that to do dev work I need to first run that command before my API can connect to the DB. Is that usual?
Sorry for the potentially noob question, I’ve only really used Azure DBs but I’m wanting to move everything over to Fly now as it’s so good!
Cheers