diff --git a/postgresql/_example/main.go b/postgresql/_example/main.go index 6377714527ccd11eaf5c562b95b1f721c30161cd..cd5d5ed94373454898c2d6c2d85fe7928d35e0ca 100644 --- a/postgresql/_example/main.go +++ b/postgresql/_example/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "log" + "os" "time" "upper.io/db" // Imports the main db package. @@ -11,9 +12,9 @@ import ( var settings = db.Settings{ Database: `upperio_tests`, // Database name. - Host: `testserver.local`, - User: `upperio`, // Database username. - Password: `upperio`, // Database password. + Host: `127.0.0.1`, + User: `upperio_tests`, // Database username. + Password: `upperio_secret`, // Database password. } // Birthday example struct. @@ -26,6 +27,10 @@ type Birthday struct { func main() { + if os.Getenv("TEST_HOST") != "" { + settings.Host = os.Getenv("TEST_HOST") + } + // Attemping to establish a connection to the database. sess, err := db.Open("postgresql", settings)