30 lines
641 B
Go
30 lines
641 B
Go
//go:build test
|
|
// +build test
|
|
|
|
package db
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
// DB is a compatibility alias for Conn, for tests not yet migrated from db.Conn to db.Conn.
|
|
|
|
func init() {
|
|
// Set defaults for test environment if not already set
|
|
if os.Getenv("POSTGRES_HOST") == "" {
|
|
os.Setenv("POSTGRES_HOST", "localhost")
|
|
}
|
|
if os.Getenv("POSTGRES_USER") == "" {
|
|
os.Setenv("POSTGRES_USER", "myuser")
|
|
}
|
|
if os.Getenv("POSTGRES_PASSWORD") == "" {
|
|
os.Setenv("POSTGRES_PASSWORD", "mypassword")
|
|
}
|
|
if os.Getenv("POSTGRES_DB") == "" {
|
|
os.Setenv("POSTGRES_DB", "crussell_test")
|
|
}
|
|
if os.Getenv("GO_TESTING") == "" {
|
|
os.Setenv("GO_TESTING", "1")
|
|
}
|
|
}
|