summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go16
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 {