We're Hiring!

Mattermost, Inc.

PostgreSQL: Unix Domain Socket + Password Authentication

i want to use a domain socket with postgresql with password authentication. is this supported?

pg_hba.conf:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local     mmdb         mmuser                                      scram-sha-256

i can’t get mattermost to connect:

{"level":"error","ts":1619504313.2954137,"caller":"sqlstore/supplier.go:247","msg":"Failed to ping DB","error":"pq: password authentication failed for user \"mmuser\"","retrying in seconds":10}

in mattermost’s config.json, i have tried for DataSource:

"postgres:///mmuser:mypassword/mmdb?host=/var/run/postgresql"
"postgres:///mmuser:mypassword@/mmdb?host=/var/run/postgresql"
"postgres:///mmuser:mypassword@unix/mmdb?host=/var/run/postgresql"
"postgres:///mmuser:mypassword@unix(/var/run/postgresql)/mmdb?host=/var/run/postgresql"
"postgres:///mmuser:mypassword@unix(/var/run/postgresql)/mmdb"

is there a way to do this, or should i dream on and just do peer auth?