This commit is contained in:
@@ -12,15 +12,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func resetEnv() {
|
func resetEnv() {
|
||||||
host := "localhost"
|
|
||||||
if h := os.Getenv("POSTGRES_HOST"); h != "" {
|
|
||||||
host = h
|
|
||||||
} else if h := os.Getenv("TEST_DB_HOST"); h != "" {
|
|
||||||
host = h
|
|
||||||
}
|
|
||||||
os.Setenv("POSTGRES_USER", "myuser")
|
os.Setenv("POSTGRES_USER", "myuser")
|
||||||
os.Setenv("POSTGRES_PASSWORD", "mypassword")
|
os.Setenv("POSTGRES_PASSWORD", "mypassword")
|
||||||
os.Setenv("POSTGRES_HOST", host)
|
if os.Getenv("POSTGRES_HOST") == "" {
|
||||||
|
os.Setenv("POSTGRES_HOST", "localhost")
|
||||||
|
}
|
||||||
os.Setenv("POSTGRES_DB", "crussell_test_db")
|
os.Setenv("POSTGRES_DB", "crussell_test_db")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,8 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Set defaults for test environment if not already set
|
// Set defaults for test environment if not already set
|
||||||
host := os.Getenv("POSTGRES_HOST")
|
if os.Getenv("POSTGRES_HOST") == "" {
|
||||||
if host == "" {
|
os.Setenv("POSTGRES_HOST", "localhost")
|
||||||
if h := os.Getenv("TEST_DB_HOST"); h != "" {
|
|
||||||
host = h
|
|
||||||
} else {
|
|
||||||
host = "localhost"
|
|
||||||
}
|
|
||||||
os.Setenv("POSTGRES_HOST", host)
|
|
||||||
}
|
}
|
||||||
if os.Getenv("POSTGRES_USER") == "" {
|
if os.Getenv("POSTGRES_USER") == "" {
|
||||||
os.Setenv("POSTGRES_USER", "myuser")
|
os.Setenv("POSTGRES_USER", "myuser")
|
||||||
|
|||||||
Reference in New Issue
Block a user