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