26 lines
1.1 KiB
Go
26 lines
1.1 KiB
Go
package config
|
|
|
|
// ServerConfig holds configuration for HTTP server
|
|
type ServerConfig struct {
|
|
Domain string `mapstructure:"domain"`
|
|
HTTPPort string `mapstructure:"http_port"`
|
|
GRPCPort string `mapstructure:"grpc_port"`
|
|
RPCHost string `mapstructure:"rpc_host"`
|
|
RPCPort string `mapstructure:"rpc_port"`
|
|
WebHost string `mapstructure:"web_host"`
|
|
WebPort string `mapstructure:"web_port"`
|
|
MaxFileSize int64 `mapstructure:"max_file_size"` // Maximum file size in bytes
|
|
MaxFileSizeMB int `mapstructure:"max_file_size_mb"` // Maximum file size in MB (for convenience)
|
|
CleanupQueues bool `mapstructure:"cleanup_queues"` // Whether to cleanup existing queues on startup
|
|
JWTSecret string `mapstructure:"jwt_secret"` // JWT secret key for token signing
|
|
}
|
|
|
|
// GetMaxFileSizeBytes returns the maximum file size in bytes
|
|
func (s *ServerConfig) GetMaxFileSizeBytes() int64 {
|
|
if s.MaxFileSize > 0 {
|
|
return s.MaxFileSize
|
|
}
|
|
// Convert MB to bytes if MaxFileSize is not set
|
|
return int64(s.MaxFileSizeMB) * 1024 * 1024
|
|
}
|