Skip to content

Commit

Permalink
Adds defaults for status query. Refs #3
Browse files Browse the repository at this point in the history
  • Loading branch information
ariel17 committed Mar 7, 2023
1 parent d7de0be commit 7937b8b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/configs/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
)

const (
dsnKey = "DATABASE_DSN"
statusQueryKey = "DATABASE_STATUS_QUERY"
dsnKey = "DATABASE_DSN"
statusQueryKey = "DATABASE_STATUS_QUERY"
defaultStatusQuery = "SELECT 1"
)

var (
Expand All @@ -27,5 +28,9 @@ func GetStatusQuery() string {

func init() {
dsn = os.Getenv(dsnKey)

statusQuery = os.Getenv(statusQueryKey)
if statusQuery == "" {
statusQuery = defaultStatusQuery
}
}

0 comments on commit 7937b8b

Please sign in to comment.