From 86b1f42e3c5601ff10621a9779cf0076590797a1 Mon Sep 17 00:00:00 2001 From: Chia Date: Wed, 5 Aug 2026 09:26:05 +1200 Subject: add sth. --- internal/config/config.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'internal/config/config.go') diff --git a/internal/config/config.go b/internal/config/config.go index 8c21c6c..97ecb21 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -53,10 +53,12 @@ type ControlPlaneConfig struct { } type AdminConfig struct { - Enabled bool `json:"enabled"` - TokenEnv string `json:"token_env"` - BasePath string `json:"base_path"` - Token string `json:"-"` + Enabled bool `json:"enabled"` + TokenEnv string `json:"token_env"` + BasePath string `json:"base_path"` + RegistrationEnabled bool `json:"registration_enabled"` + SessionTTLHours int `json:"session_ttl_hours"` + Token string `json:"-"` } type UpstreamHTTPConfig struct { @@ -188,6 +190,9 @@ func applyDefaults(cfg *Config) { if cfg.Admin.BasePath == "" { cfg.Admin.BasePath = "/admin" } + if cfg.Admin.SessionTTLHours == 0 { + cfg.Admin.SessionTTLHours = 12 + } if cfg.UpstreamHTTP.MaxIdleConnections == 0 { cfg.UpstreamHTTP.MaxIdleConnections = 4096 } @@ -285,6 +290,9 @@ func Validate(cfg Config) error { if !strings.HasPrefix(cfg.Admin.BasePath, "/") || cfg.Admin.BasePath == "/" { return errors.New("admin.base_path must start with / and cannot be /") } + if cfg.Admin.SessionTTLHours < 1 || cfg.Admin.SessionTTLHours > 720 { + return errors.New("admin.session_ttl_hours must be between 1 and 720") + } } if cfg.Billing.Enabled { if !cfg.ControlPlane.Enabled { -- cgit v1.2.3