From 1c81b4841ad0166a31e5d76194da2c721c82d88f Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:15:46 -0700 Subject: [PATCH] test conf load env --- src/config_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/config_test.go diff --git a/src/config_test.go b/src/config_test.go new file mode 100644 index 0000000..0643b60 --- /dev/null +++ b/src/config_test.go @@ -0,0 +1,32 @@ +package src + +import ( + "os" + "testing" +) + +func TestConfigLoadEnv(t *testing.T) { + c := Config{ + Listen: "default", + Forwards: "default", + Hello: "default", + } + + os.Setenv("LISTEN", "$LISTEN") + os.Setenv("FORWARDS", "") + os.Setenv("HELLO_B64", "$HELLO_B64") + + if err := c.loadEnv(); err != nil { + t.Fatal(err) + } + + if c.Listen != "$LISTEN" { + t.Error("listen", c.Listen) + } + if c.Forwards != "default" { + t.Error("forwards", c.Forwards) + } + if c.Hello != "$HELLO_B64" { + t.Error("hello", c.Hello) + } +}