1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-11 12:59:16 +00:00

feat: add static api key env variable (#1229)

This commit is contained in:
Elias Schneider
2026-01-11 15:36:27 +01:00
committed by GitHub
parent 9ca3d33c88
commit 746aa71d67
6 changed files with 78 additions and 6 deletions

View File

@@ -50,6 +50,7 @@ type EnvConfigSchema struct {
InternalAppURL string `env:"INTERNAL_APP_URL"`
UiConfigDisabled bool `env:"UI_CONFIG_DISABLED"`
DisableRateLimiting bool `env:"DISABLE_RATE_LIMITING"`
StaticApiKey string `env:"STATIC_API_KEY" options:"file"`
FileBackend string `env:"FILE_BACKEND" options:"toLower"`
UploadPath string `env:"UPLOAD_PATH"`
@@ -200,6 +201,10 @@ func ValidateEnvConfig(config *EnvConfigSchema) error {
return errors.New("AUDIT_LOG_RETENTION_DAYS must be greater than 0")
}
if config.StaticApiKey != "" && len(config.StaticApiKey) < 16 {
return errors.New("STATIC_API_KEY must be at least 16 characters long")
}
return nil
}