|
@ -17,7 +17,7 @@ type FileSystemType int |
|
|
type Settings struct { |
|
|
type Settings struct { |
|
|
Endpoint string `json:"endpoint"` |
|
|
Endpoint string `json:"endpoint"` |
|
|
Token string `json:"token"` |
|
|
Token string `json:"token"` |
|
|
RequestsPerMinute int `json:"requests_per_minute"` |
|
|
|
|
|
|
|
|
RateLimiter RateLimiterSettings `json:"rate_limiter"` |
|
|
StorageProvider StorageSettings `json:"storage_provider"` |
|
|
StorageProvider StorageSettings `json:"storage_provider"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -26,6 +26,11 @@ type StorageSettings struct { |
|
|
BasePath string `json:"base_path"` |
|
|
BasePath string `json:"base_path"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type RateLimiterSettings struct { |
|
|
|
|
|
RequestsPerMinute int `json:"requests_per_minute"` |
|
|
|
|
|
AllowedBurst int `json:"allowed_burst"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func parseSettings(data []byte) Settings { |
|
|
func parseSettings(data []byte) Settings { |
|
|
settings := Settings{} |
|
|
settings := Settings{} |
|
|
|
|
|
|
|
@ -52,7 +57,10 @@ func LoadSettings(fileSystem afero.Fs) (Settings, error) { |
|
|
defaultSettings := Settings{ |
|
|
defaultSettings := Settings{ |
|
|
Endpoint: "127.0.0.1:8000", |
|
|
Endpoint: "127.0.0.1:8000", |
|
|
Token: "changeme", |
|
|
Token: "changeme", |
|
|
|
|
|
RateLimiter: RateLimiterSettings{ |
|
|
RequestsPerMinute: 20, |
|
|
RequestsPerMinute: 20, |
|
|
|
|
|
AllowedBurst: 5, |
|
|
|
|
|
}, |
|
|
StorageProvider: StorageSettings{ |
|
|
StorageProvider: StorageSettings{ |
|
|
Type: Local, |
|
|
Type: Local, |
|
|
BasePath: "assets", |
|
|
BasePath: "assets", |
|
|