sync to github

This commit is contained in:
Alexander Renz 2024-12-09 14:32:33 +01:00
parent 8e5ef77165
commit 474c46668b
2 changed files with 125 additions and 117 deletions

View File

@ -2,6 +2,8 @@
**HMAC File Server** is a secure, scalable, and feature-rich file server with advanced capabilities like HMAC authentication, resumable uploads, chunked uploads, file versioning, and optional ClamAV scanning for file integrity and security. This server is built with extensibility and operational monitoring in mind, including Prometheus metrics support and Redis integration. **HMAC File Server** is a secure, scalable, and feature-rich file server with advanced capabilities like HMAC authentication, resumable uploads, chunked uploads, file versioning, and optional ClamAV scanning for file integrity and security. This server is built with extensibility and operational monitoring in mind, including Prometheus metrics support and Redis integration.
> **Credits:** The **HMAC File Server** is based on the source code of [Thomas Leister's prosody-filer](https://github.com/ThomasLeister/prosody-filer). Many features and design elements have been inspired or derived from this project.
--- ---
## Features ## Features
@ -59,6 +61,10 @@ When `AutoAdjustWorkers` is enabled, the number of workers for HMAC operations a
If `AutoAdjustWorkers = true`, the values for `NumWorkers` and `NumScanWorkers` in the configuration file will be ignored, and the server will automatically adjust these values. If `AutoAdjustWorkers = true`, the values for `NumWorkers` and `NumScanWorkers` in the configuration file will be ignored, and the server will automatically adjust these values.
### Network Events Monitoring
Setting `NetworkEvents = false` in the server configuration disables the logging and tracking of network-related events within the application. This means that functionalities such as monitoring IP changes or recording network activity will be turned off.
--- ---
## Example `config.toml` ## Example `config.toml`
@ -76,6 +82,7 @@ FileTTL = "1y"
DeduplicationEnabled = true DeduplicationEnabled = true
MinFreeBytes = "100MB" MinFreeBytes = "100MB"
AutoAdjustWorkers = true # Enable auto-adjustment for worker scaling AutoAdjustWorkers = true # Enable auto-adjustment for worker scaling
NetworkEvents = false # Disable logging of network events
[timeouts] [timeouts]
ReadTimeout = "480s" ReadTimeout = "480s"

View File

@ -107,6 +107,7 @@ type ServerConfig struct {
DeduplicationEnabled bool `mapstructure:"DeduplicationEnabled"` DeduplicationEnabled bool `mapstructure:"DeduplicationEnabled"`
MinFreeByte string `mapstructure:"MinFreeByte"` MinFreeByte string `mapstructure:"MinFreeByte"`
AutoAdjustWorkers bool `mapstructure:"AutoAdjustWorkers"` AutoAdjustWorkers bool `mapstructure:"AutoAdjustWorkers"`
NetworkEvents bool `mapstructure:"NetworkEvents"` // Added field
} }
type TimeoutConfig struct { type TimeoutConfig struct {
@ -468,9 +469,9 @@ func setDefaults() {
viper.SetDefault("server.MetricsEnabled", true) viper.SetDefault("server.MetricsEnabled", true)
viper.SetDefault("server.MetricsPort", "9090") viper.SetDefault("server.MetricsPort", "9090")
viper.SetDefault("server.FileTTL", "8760h") viper.SetDefault("server.FileTTL", "8760h")
viper.SetDefault("server.MinFreeBytes", 100<<20) viper.SetDefault("server.MinFreeBytes", "100MB")
viper.SetDefault("server.AutoAdjustWorkers", true) viper.SetDefault("server.AutoAdjustWorkers", true)
viper.SetDefault("server.NetworkEvents", true) // Set default
_, err := parseTTL("1D") _, err := parseTTL("1D")
if err != nil { if err != nil {
log.Warnf("Failed to parse TTL: %v", err) log.Warnf("Failed to parse TTL: %v", err)
@ -1546,7 +1547,7 @@ func MonitorRedisHealth(ctx context.Context, client *redis.Client, checkInterval
} }
redisConnected = false redisConnected = false
} else { } else {
if (!redisConnected) { if !redisConnected {
log.Info("Redis reconnected successfully") log.Info("Redis reconnected successfully")
} }
redisConnected = true redisConnected = true