diff options
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index fc392b4..36c8be5 100644 --- a/internal/config/config.go +++ b/internal/config/config.go | |||
| @@ -6,18 +6,18 @@ import ( | |||
| 6 | "strings" | 6 | "strings" |
| 7 | "time" | 7 | "time" |
| 8 | 8 | ||
| 9 | "northwest.io/muxstr/internal/nostr" | ||
| 10 | "gopkg.in/yaml.v3" | 9 | "gopkg.in/yaml.v3" |
| 10 | "northwest.io/nostr" | ||
| 11 | ) | 11 | ) |
| 12 | 12 | ||
| 13 | type Config struct { | 13 | type Config struct { |
| 14 | Server ServerConfig `yaml:"server"` | 14 | Server ServerConfig `yaml:"server"` |
| 15 | Database DatabaseConfig `yaml:"database"` | 15 | Database DatabaseConfig `yaml:"database"` |
| 16 | Auth AuthConfig `yaml:"auth"` | 16 | Auth AuthConfig `yaml:"auth"` |
| 17 | RateLimit RateLimitConfig `yaml:"rate_limit"` | 17 | RateLimit RateLimitConfig `yaml:"rate_limit"` |
| 18 | Metrics MetricsConfig `yaml:"metrics"` | 18 | Metrics MetricsConfig `yaml:"metrics"` |
| 19 | Logging LoggingConfig `yaml:"logging"` | 19 | Logging LoggingConfig `yaml:"logging"` |
| 20 | Storage StorageConfig `yaml:"storage"` | 20 | Storage StorageConfig `yaml:"storage"` |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | type ServerConfig struct { | 23 | type ServerConfig struct { |
| @@ -48,17 +48,17 @@ type AuthOperationConfig struct { | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | type RateLimitConfig struct { | 50 | type RateLimitConfig struct { |
| 51 | Enabled bool `yaml:"enabled"` | 51 | Enabled bool `yaml:"enabled"` |
| 52 | DefaultRPS float64 `yaml:"default_rps"` | 52 | DefaultRPS float64 `yaml:"default_rps"` |
| 53 | DefaultBurst int `yaml:"default_burst"` | 53 | DefaultBurst int `yaml:"default_burst"` |
| 54 | IPRPS float64 `yaml:"ip_rps"` | 54 | IPRPS float64 `yaml:"ip_rps"` |
| 55 | IPBurst int `yaml:"ip_burst"` | 55 | IPBurst int `yaml:"ip_burst"` |
| 56 | Methods map[string]MethodLimit `yaml:"methods"` | 56 | Methods map[string]MethodLimit `yaml:"methods"` |
| 57 | Users map[string]UserLimit `yaml:"users"` | 57 | Users map[string]UserLimit `yaml:"users"` |
| 58 | SkipMethods []string `yaml:"skip_methods"` | 58 | SkipMethods []string `yaml:"skip_methods"` |
| 59 | SkipUsers []string `yaml:"skip_users"` | 59 | SkipUsers []string `yaml:"skip_users"` |
| 60 | CleanupInterval time.Duration `yaml:"cleanup_interval"` | 60 | CleanupInterval time.Duration `yaml:"cleanup_interval"` |
| 61 | MaxIdleTime time.Duration `yaml:"max_idle_time"` | 61 | MaxIdleTime time.Duration `yaml:"max_idle_time"` |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | type MethodLimit struct { | 64 | type MethodLimit struct { |
| @@ -343,7 +343,7 @@ func (c *Config) Save(filename string) error { | |||
| 343 | return fmt.Errorf("failed to marshal config: %w", err) | 343 | return fmt.Errorf("failed to marshal config: %w", err) |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | if err := os.WriteFile(filename, data, 0644); err != nil { | 346 | if err := os.WriteFile(filename, data, 0o644); err != nil { |
| 347 | return fmt.Errorf("failed to write config file: %w", err) | 347 | return fmt.Errorf("failed to write config file: %w", err) |
| 348 | } | 348 | } |
| 349 | 349 | ||
