Skip to content
Snippets Groups Projects
Verified Commit a0724e75 authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

Use Environment variable for Postgres SSL Mode setting

parent 24c1453c
No related branches found
No related tags found
1 merge request!1Use Environment variable for Postgres SSL Mode setting
......@@ -18,6 +18,7 @@ type PostgresConfig struct {
User string `env:"POSTGRES_USER" envDefault:"postgres"`
Password string `env:"POSTGRES_PASSWORD" envDefault:"postgres"`
Database string `env:"POSTGRES_DB" envDefault:"postgres"`
SSLMode string `env:"SSL_MODE" envDefault:"disable"`
}
var Db *gorm.DB
......@@ -30,7 +31,7 @@ func Dbinit() {
c = validConfig
}
dsn := string("host="+ c.Host + " user=" + c.User + " password=" + c.Password + " port=" + c.Port + " sslmode=disabled TimeZone=Europe/Budapest")
dsn := string("host="+ c.Host + " user=" + c.User + " password=" + c.Password + " port=" + c.Port + " sslmode="+ c.SSLMode +" TimeZone=Europe/Budapest")
Db, err = gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment