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
When changing .env file to point to a remote Postgres instance example not working #465
When running this example locally everything works fine, but as soon as I change the
PG.HOST=XXX.XXX.XXX.XXX to a remote postgres instance the example still trys to connect to the local instance.
and everything works fine. The record gets inserted into my local Postgres database.
Then I installed a remote instance of Postgres onto the Microsoft Azure Cloud environment and changed
PG.HOST=127.0.0.1 to point to the Microsoft Cloud Postgres IP address. I made sure to set the security policy to be able to connect,
I proved that I can by running pgAdmin 4 and connecting to the remote Postgres Instance.
Upon changing the PG.HOST, When I run my code it seems like it doesnt even use the PG.HOST setting. It always goes locally regardless of what PG.HOST is set to.
I can prove this because when I have the PG.HOST point to the remote Postgres instance and I shut down my local postgres instance I get :
An error occured while creating a new object: error connecting to server: No connection could be made because the target machine actively refused it. (os error 10061)
Activity
robjtede commentedon Nov 27, 2021
Might just be running it from the wrong directory.
Can you provide a more complete set of reproduction steps?
alexbegun commentedon Nov 27, 2021
So my regular test my env file looks exactly the same as the example:
SERVER_ADDR=127.0.0.1:80
PG.USER=tester
PG.PASSWORD=tester
PG.HOST=127.0.0.1
PG.PORT=5432
PG.DBNAME=testing_db
PG.POOL.MAX_SIZE=16
I do a post to 127.0.0.1:80/users with
{
"email":"test2@email.com",
"first_name":"test_f",
"last_name":"test_l",
"username":"test12"
}
and everything works fine. The record gets inserted into my local Postgres database.
Then I installed a remote instance of Postgres onto the Microsoft Azure Cloud environment and changed
PG.HOST=127.0.0.1 to point to the Microsoft Cloud Postgres IP address. I made sure to set the security policy to be able to connect,
I proved that I can by running pgAdmin 4 and connecting to the remote Postgres Instance.
Upon changing the PG.HOST, When I run my code it seems like it doesnt even use the PG.HOST setting. It always goes locally regardless of what PG.HOST is set to.
I can prove this because when I have the PG.HOST point to the remote Postgres instance and I shut down my local postgres instance I get :
An error occured while creating a new object: error connecting to server: No connection could be made because the target machine actively refused it. (os error 10061)