[server] Allow a configurable sslmode

Tested

- Existing defaults remain unchanged
- Setting db.sslmode = require in museum.yaml is honoured (in the docker compose environment, that causes the db connection to fail as expected)
This commit is contained in:
Manav Rathi 2024-04-05 11:43:16 +05:30
parent 360aa2903f
commit 74decc32de
No known key found for this signature in database
2 changed files with 7 additions and 3 deletions

View file

@ -76,6 +76,9 @@ db:
host: localhost
port: 5432
name: ente_db
# You might want to set this to "require" for production
# See https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-PROTECTION
sslmode: disable
# These can be specified here, or alternatively provided via the environment
# as ENTE_DB_USER and ENTE_DB_PASSWORD.
user:
@ -303,4 +306,4 @@ jobs:
# By default, this job is disabled.
enabled: false
# If provided, only objects that begin with this prefix are pruned.
prefix: ""
prefix: ""

View file

@ -103,12 +103,13 @@ func doesFileExist(path string) (bool, error) {
func GetPGInfo() string {
return fmt.Sprintf("host=%s port=%d user=%s "+
"password=%s dbname=%s sslmode=disable",
"password=%s dbname=%s sslmode=%s",
viper.GetString("db.host"),
viper.GetInt("db.port"),
viper.GetString("db.user"),
viper.GetString("db.password"),
viper.GetString("db.name"))
viper.GetString("db.name"),
viper.GetString("db.sslmode"))
}
func IsLocalEnvironment() bool {