fix: Secure sql connection (#332)

* feat: sql ssl connection

* fix: simpler implementation of ssl-config in sql

* fix(config): set db ssl connection by env vars
This commit is contained in:
Silvan
2020-07-03 12:44:08 +02:00
committed by GitHub
parent a71b5e35d7
commit 6736b2867e
6 changed files with 103 additions and 67 deletions

View File

@@ -2,6 +2,7 @@ package repository
import (
"database/sql"
"github.com/caos/zitadel/internal/config/types"
"github.com/caos/zitadel/internal/errors"
"github.com/jinzhu/gorm"
@@ -12,7 +13,7 @@ type ViewConfig struct {
}
func Start(conf ViewConfig) (*sql.DB, *gorm.DB, error) {
sqlClient, err := sql.Open("postgres", conf.SQL.ConnectionString())
sqlClient, err := conf.SQL.Start()
if err != nil {
return nil, nil, errors.ThrowPreconditionFailed(err, "SQL-9qBtr", "unable to open database connection")
}