init: initial commit
Checks / verify (push) Canceled after 41s

This commit is contained in:
2026-10-06 11:24:02 +08:00
parent 456e87d4f2
commit ba6dfffab7
63 changed files with 7223 additions and 0 deletions
@@ -0,0 +1,25 @@
package config
import (
"net/url"
"testing"
)
func TestDatabaseURLPreservesCredentials(t *testing.T) {
c := Config{PGHost: "192.168.100.127", PGPort: "5432", PGUser: "user@name", PGPassword: "p@ss:/?#&", PGSSLMode: "require"}
u, err := url.Parse(c.DatabaseURL("veyra"))
if err != nil {
t.Fatal(err)
}
password, _ := u.User.Password()
if password != c.PGPassword || u.User.Username() != c.PGUser || u.Path != "/veyra" || u.Query().Get("sslmode") != "require" {
t.Fatal("connection URL changed configuration values")
}
}
func TestRejectInvalidRedisDB(t *testing.T) {
t.Setenv("REDIS_DB", "-1")
if _, err := Load(); err == nil {
t.Fatal("negative database must be rejected")
}
}