@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestConfigFromEnvironment(t *testing.T) {
|
||||
t.Setenv("GARDOMATIC_WEB_HOST", "0.0.0.0")
|
||||
t.Setenv("GARDOMATIC_WEB_PORT", "4444")
|
||||
t.Setenv("GARDOMATIC_API_BASE_URL", "https://api.example.com")
|
||||
cfg, err := configFromEnvironment()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.Host != "0.0.0.0" || cfg.Port != 4444 || cfg.APIBaseURL != "https://api.example.com" {
|
||||
t.Fatalf("unexpected config: %#v", cfg)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user