I'm trying to connect to postgres via node using the md5 authentication method.
My pg_hba_conf file looks like this:
"local" is for Unix domain socket connections only
local all all md5
IPv4 local connections:
host all all 127.0.0.1/32 md5
IPv6 local connections:
host all all ::1/128 md5
I can connect to the database via psql without any problems, but my question is how do you create the connection string within node to connect to postgres when via md5? If I change the pg_hba.conf to use 'password' as the authentication method, then I can connect to the database with the following:
let connectionString = postgres://user:password@localhost:5432/database';
I had thought that I could md5hash my password within the connectionString e.g:
let password = crypto.createHash('md5').update(my_password).digest('hex');
let connectionString = 'postgres://user:' + password + '@localhost:5432/database';
But this didn't work :-(
Can someone point me in the right direction as to how you access postgres via Node using md5 authentication?
Cheers