database configuration only via PG* env variables and MQTT password only via configured env var
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-12-17 13:53:16 +01:00
parent 6d932f56c8
commit ee2c5f31e8
11 changed files with 59 additions and 38 deletions

View File

@ -14,9 +14,10 @@ type DatabaseHandle struct {
dbh *gorm.DB
}
func NewDatabaseHandle(dsn string) *DatabaseHandle {
func NewDatabaseHandle() *DatabaseHandle {
var db DatabaseHandle
conn, err := gorm.Open(postgres.Open(dsn))
// inject the whole database configuration via the well-known PG* env variables
conn, err := gorm.Open(postgres.Open(""))
if err != nil {
log.Printf("Unable to open database connection: %s", err)
db.initialized = false