mirror of
https://github.com/dnote/dnote
synced 2026-03-14 22:45:50 +01:00
Fix test by enabling database SSL only in production (#226)
* Fix test * Always specify sslmode
This commit is contained in:
parent
73d66eea07
commit
ee14a3c9be
1 changed files with 9 additions and 1 deletions
|
|
@ -34,13 +34,21 @@ var (
|
|||
)
|
||||
|
||||
func getPGConnectionString() string {
|
||||
var sslmode string
|
||||
if os.Getenv("GO_ENV") == "PRODUCTION" {
|
||||
sslmode = "require"
|
||||
} else {
|
||||
sslmode = "disable"
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"host=%s port=%s dbname=%s user=%s password=%s",
|
||||
"host=%s port=%s dbname=%s user=%s password=%s sslmode=%s",
|
||||
os.Getenv("DBHost"),
|
||||
os.Getenv("DBPort"),
|
||||
os.Getenv("DBName"),
|
||||
os.Getenv("DBUser"),
|
||||
os.Getenv("DBPassword"),
|
||||
sslmode,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue