diff options
| author | Chia <Chia@93.nz> | 2026-08-05 09:26:05 +1200 |
|---|---|---|
| committer | Chia <Chia@93.nz> | 2026-08-05 09:26:05 +1200 |
| commit | 86b1f42e3c5601ff10621a9779cf0076590797a1 (patch) | |
| tree | ccf584f0404dece2e4dae2eee847b665f57c0737 /internal/config/config.go | |
| parent | 1a3d7f9a8a181df48f0e911cbe17a3fad3ab9ac9 (diff) | |
add sth.
Diffstat (limited to '')
| -rw-r--r-- | internal/config/config.go | 16 |
1 files changed, 12 insertions, 4 deletions
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 { |
