Skip to content

Commit

Permalink
Merge pull request #76 from sooraj-sky/database
Browse files Browse the repository at this point in the history
changed db url to env
  • Loading branch information
sooraj-sky authored Jan 21, 2023
2 parents 5bc4d92 + a3b994d commit f9da35f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ import (
"gorm.io/driver/postgres"
"gorm.io/gorm"
"log"
"os"
)

func main() {
log.Println("Launching sky-meter")
sentry.SentryInit()
dbconnect := os.Getenv("dbconnect")
if opsgenieSecret == "" {
log.Fatal("Please specify the opsgeniesecret as environment variable, e.g. sooraj@sky:~/go/src/sky-meter$ export dbconnect=host=localhost user=postgres password=postgres dbname=postgres port=5433 sslmode=disable")
}
db, err := gorm.Open(postgres.New(postgres.Config{
DSN: "host=localhost user=postgres password=postgres dbname=postgres port=5433 sslmode=disable",
DSN: dbconnect,
PreferSimpleProtocol: true, // disables implicit prepared statement usage

}), &gorm.Config{})
Expand Down

0 comments on commit f9da35f

Please sign in to comment.