mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-20 20:07:52 +02:00
Add environ variable to configure the postgres DB
This commit is contained in:
parent
a61e56a01b
commit
38c185c9f9
@ -352,7 +352,11 @@ func OpenDB() (*gorm.DB, error) {
|
|||||||
return db, nil
|
return db, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
db, err := gorm.Open(postgres.Open(PostgresDb), &gorm.Config{})
|
postgresDb := PostgresDb
|
||||||
|
if os.Getenv("HISHTORY_POSTGRES_DB") != "" {
|
||||||
|
postgresDb = os.Getenv("HISHTORY_POSTGRES_DB")
|
||||||
|
}
|
||||||
|
db, err := gorm.Open(postgres.Open(postgresDb), &gorm.Config{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to connect to the DB: %v", err)
|
return nil, fmt.Errorf("failed to connect to the DB: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user