|
|
@ -16,7 +16,7 @@ type FileSystemType int |
|
|
|
|
|
|
|
type Settings struct { |
|
|
|
Endpoint string `json:"endpoint"` |
|
|
|
Token string `json:"token"` |
|
|
|
Authentication AuthenticationSettings `json:"authentication"` |
|
|
|
RateLimiter RateLimiterSettings `json:"rate_limiter"` |
|
|
|
StorageProvider StorageSettings `json:"storage_provider"` |
|
|
|
} |
|
|
@ -26,7 +26,13 @@ type StorageSettings struct { |
|
|
|
BasePath string `json:"base_path"` |
|
|
|
} |
|
|
|
|
|
|
|
type AuthenticationSettings struct { |
|
|
|
Enabled bool `json:"enabled"` |
|
|
|
Token string `json:"token"` |
|
|
|
} |
|
|
|
|
|
|
|
type RateLimiterSettings struct { |
|
|
|
Enabled bool `json:"enabled"` |
|
|
|
RequestsPerMinute int `json:"requests_per_minute"` |
|
|
|
AllowedBurst int `json:"allowed_burst"` |
|
|
|
} |
|
|
@ -56,8 +62,12 @@ func LoadSettings(fileSystem afero.Fs) (Settings, error) { |
|
|
|
// If file does not exist, create default settings
|
|
|
|
defaultSettings := Settings{ |
|
|
|
Endpoint: "127.0.0.1:8000", |
|
|
|
Authentication: AuthenticationSettings{ |
|
|
|
Enabled: true, |
|
|
|
Token: "changeme", |
|
|
|
}, |
|
|
|
RateLimiter: RateLimiterSettings{ |
|
|
|
Enabled: true, |
|
|
|
RequestsPerMinute: 20, |
|
|
|
AllowedBurst: 5, |
|
|
|
}, |
|
|
|