mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
DBinfo now provided by global params
This commit is contained in:
parent
ae0f729a55
commit
62de87ff72
1 changed files with 5 additions and 2 deletions
|
@ -8,12 +8,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DB_NAME = "villasdb"
|
DB_NAME = "villasdb"
|
||||||
|
DB_HOST = "/tmp"
|
||||||
|
DB_SSLMODE = "disable" // TODO: change that for production
|
||||||
)
|
)
|
||||||
|
|
||||||
func StartDB() {
|
func StartDB() {
|
||||||
// Init connection's information
|
// Init connection's information
|
||||||
dbinfo := fmt.Sprintf("host=/tmp sslmode=disable dbname=%s", DB_NAME)
|
dbinfo := fmt.Sprintf("host=%s sslmode=%s dbname=%s",
|
||||||
|
DB_HOST, DB_SSLMODE, DB_NAME)
|
||||||
db, err := gorm.Open("postgres", dbinfo)
|
db, err := gorm.Open("postgres", dbinfo)
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
Loading…
Add table
Reference in a new issue