go fmt && fix dataSources

Signed-off-by: Maximilian Seifert <max.seifert@drglitch.net>
This commit is contained in:
Maximilian Seifert 2019-03-27 23:02:07 +01:00
parent 7edf1a038a
commit e53c293a70
2 changed files with 4 additions and 5 deletions

View file

@ -14,6 +14,7 @@ import (
var dataSource string var dataSource string
var insideCi = false var insideCi = false
var insideDocker = false var insideDocker = false
const dbName = "dendrite_device" const dbName = "dendrite_device"
func init() { func init() {
@ -32,12 +33,11 @@ func init() {
if insideCi { if insideCi {
dataSource = fmt.Sprintf("postgres://postgres@localhost/%s?sslmode=disable", dbName) dataSource = fmt.Sprintf("postgres://postgres@localhost/%s?sslmode=disable", dbName)
} else if insideDocker { } else if insideDocker {
dataSource = fmt.Sprintf("postgres://dendrite:itsasecret@localhost/%s?sslmode=disable", dbName) dataSource = fmt.Sprintf("postgres://dendrite:itsasecret@postgres/%s?sslmode=disable", dbName)
} else { } else {
dataSource = fmt.Sprintf("postgres://dendrite:itsasecret@localhost:15432/%s?sslmode=disable", dbName) dataSource = fmt.Sprintf("postgres://dendrite:itsasecret@localhost:15432/%s?sslmode=disable", dbName)
} }
if insideCi { if insideCi {
database := "dendrite_device" database := "dendrite_device"
cmd := exec.Command("psql", database) cmd := exec.Command("psql", database)
@ -52,8 +52,6 @@ func init() {
} }
} }
type deviceSpec struct { type deviceSpec struct {
localPart string localPart string
devID string devID string

View file

@ -16,6 +16,7 @@ import (
var dataSource string var dataSource string
var insideCi = false var insideCi = false
var insideDocker = false var insideDocker = false
const dbName = "dendrite_syncapi" const dbName = "dendrite_syncapi"
func init() { func init() {
@ -34,7 +35,7 @@ func init() {
if insideCi { if insideCi {
dataSource = fmt.Sprintf("postgres://postgres@localhost/%s?sslmode=disable", dbName) dataSource = fmt.Sprintf("postgres://postgres@localhost/%s?sslmode=disable", dbName)
} else if insideDocker { } else if insideDocker {
dataSource = fmt.Sprintf("postgres://dendrite:itsasecret@localhost/%s?sslmode=disable", dbName) dataSource = fmt.Sprintf("postgres://dendrite:itsasecret@postgres/%s?sslmode=disable", dbName)
} else { } else {
dataSource = fmt.Sprintf("postgres://dendrite:itsasecret@localhost:15432/%s?sslmode=disable", dbName) dataSource = fmt.Sprintf("postgres://dendrite:itsasecret@localhost:15432/%s?sslmode=disable", dbName)
} }