Initial commit
CI / test (push) Canceled after 0s

This commit is contained in:
2026-09-12 22:22:17 +02:00
commit 904d14b64c
314 changed files with 31884 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package main
import "testing"
func TestConfigFromEnvironment(t *testing.T) {
t.Setenv("GARDOMATIC_DB_DSN", "postgres://example")
t.Setenv("GARDOMATIC_API_HOST", "127.0.0.1")
t.Setenv("GARDOMATIC_API_PORT", "4100")
t.Setenv("GARDOMATIC_CORS_TRUSTED_ORIGINS", "https://example.com, https://app.example.com")
cfg, err := configFromEnvironment()
if err != nil {
t.Fatal(err)
}
if cfg.Host != "127.0.0.1" || cfg.Port != 4100 || len(cfg.Cors.TrustedOrigins) != 2 {
t.Fatalf("unexpected config: %#v", cfg)
}
}
func TestConfigRequiresDSN(t *testing.T) {
t.Setenv("GARDOMATIC_DB_DSN", "")
if _, err := configFromEnvironment(); err == nil {
t.Fatal("expected missing DSN error")
}
}