Documentation
¶
Overview ¶
Package config 处理应用程序配置管理
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.1.0
type Config struct {
// 基础配置
Name string `json:"name"`
Description string `json:"description"`
Keywords string `json:"keywords"`
Port int `json:"port"`
Host string `json:"host"` // 新增:绑定IP地址
DataPath string `json:"data_path"`
Production bool `json:"production"`
// 数据库配置
DatabaseType string `json:"database_type"` // sqlite, mysql, postgres
DatabaseHost string `json:"database_host"`
DatabasePort int `json:"database_port"`
DatabaseName string `json:"database_name"`
DatabaseUser string `json:"database_user"`
DatabasePass string `json:"database_pass"`
DatabaseSSL string `json:"database_ssl"` // disable, require, verify-full (for postgres)
// 通知配置
NotifyTitle string `json:"notify_title"`
NotifyContent string `json:"notify_content"`
PageExplain string `json:"page_explain"`
// 上传配置
OpenUpload int `json:"open_upload"`
UploadSize int64 `json:"upload_size"`
EnableChunk int `json:"enable_chunk"`
ChunkSize int64 `json:"chunk_size"` // 新增:分片大小
MaxSaveSeconds int `json:"max_save_seconds"`
// 下载配置 (新增)
EnableConcurrentDownload int `json:"enable_concurrent_download"` // 是否启用并发下载
MaxConcurrentDownloads int `json:"max_concurrent_downloads"` // 最大并发下载数
DownloadTimeout int `json:"download_timeout"` // 下载超时时间(秒)
// 过期样式
ExpireStyle []string `json:"expire_style"`
// 限流配置
UploadMinute int `json:"upload_minute"`
UploadCount int `json:"upload_count"`
ErrorMinute int `json:"error_minute"`
ErrorCount int `json:"error_count"`
// 主题配置
ThemesSelect string `json:"themes_select"`
ThemesChoices []Theme `json:"themes_choices"`
Opacity float64 `json:"opacity"`
Background string `json:"background"`
// 存储配置
FileStorage string `json:"file_storage"`
StoragePath string `json:"storage_path"`
// S3配置
S3AccessKeyID string `json:"s3_access_key_id"`
S3SecretAccessKey string `json:"s3_secret_access_key"`
S3BucketName string `json:"s3_bucket_name"`
S3EndpointURL string `json:"s3_endpoint_url"`
S3RegionName string `json:"s3_region_name"`
S3SignatureVersion string `json:"s3_signature_version"`
S3Hostname string `json:"s3_hostname"`
S3Proxy int `json:"s3_proxy"`
AWSSessionToken string `json:"aws_session_token"`
// WebDAV配置
WebDAVHostname string `json:"webdav_hostname"`
WebDAVRootPath string `json:"webdav_root_path"`
WebDAVProxy int `json:"webdav_proxy"`
WebDAVURL string `json:"webdav_url"`
WebDAVPassword string `json:"webdav_password"`
WebDAVUsername string `json:"webdav_username"`
// OneDrive配置
OneDriveDomain string `json:"onedrive_domain"`
OneDriveClientID string `json:"onedrive_client_id"`
OneDriveUsername string `json:"onedrive_username"`
OneDrivePassword string `json:"onedrive_password"`
OneDriveRootPath string `json:"onedrive_root_path"`
OneDriveProxy int `json:"onedrive_proxy"`
// NFS配置
NFSServer string `json:"nfs_server"` // NFS服务器地址 (例如: 192.168.1.100)
NFSPath string `json:"nfs_path"` // NFS路径 (例如: /nfs/storage)
NFSMountPoint string `json:"nfs_mount_point"` // 本地挂载点 (例如: /mnt/nfs)
NFSVersion string `json:"nfs_version"` // NFS版本 (3, 4, 4.1)
NFSOptions string `json:"nfs_options"` // 挂载选项 (例如: rw,sync,hard,intr)
NFSTimeout int `json:"nfs_timeout"` // 超时时间(秒)
NFSAutoMount int `json:"nfs_auto_mount"` // 是否自动挂载 0-禁用 1-启用
NFSRetryCount int `json:"nfs_retry_count"` // 重试次数
NFSSubPath string `json:"nfs_sub_path"` // NFS存储子路径 (在挂载点下的相对路径)
// 管理配置
AdminToken string `json:"admin_token"`
ShowAdminAddr int `json:"show_admin_address"`
RobotsText string `json:"robots_text"`
// 用户系统配置 (新增)
EnableUserSystem int `json:"enable_user_system"` // 是否启用用户系统 0-禁用 1-启用
AllowUserRegistration int `json:"allow_user_registration"` // 是否允许用户注册 0-禁用 1-启用
RequireEmailVerify int `json:"require_email_verify"` // 是否需要邮箱验证 0-不需要 1-需要
UserUploadSize int64 `json:"user_upload_size"` // 用户上传文件大小限制(字节)
UserStorageQuota int64 `json:"user_storage_quota"` // 用户存储配额(字节) 0-无限制
SessionExpiryHours int `json:"session_expiry_hours"` // 用户会话过期时间(小时)
MaxSessionsPerUser int `json:"max_sessions_per_user"` // 每个用户最大会话数
// JWT 密钥配置
JWTSecret string `json:"jwt_secret"` // JWT签名密钥
// MCP 服务器配置 (新增)
EnableMCPServer int `json:"enable_mcp_server"` // 是否启用 MCP 服务器 0-禁用 1-启用
MCPPort string `json:"mcp_port"` // MCP 服务器端口,默认 8081
MCPHost string `json:"mcp_host"` // MCP 服务器绑定地址,默认 0.0.0.0
// contains filtered or unexported fields
}
func (*Config) InitDefaultDataInDB ¶ added in v1.1.0
InitDefaultDataInDB 在数据库中初始化默认配置数据
func (*Config) InitWithDB ¶ added in v1.1.0
InitWithDB 使用数据库初始化配置
func (*Config) LoadFromDatabase ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.