refactor: 移除不必要的配置依赖,简化上传URL生成逻辑并添加公开访问URL支持
This commit is contained in:
@@ -59,6 +59,7 @@ type RedisConfig struct {
|
||||
// RustFSConfig RustFS对象存储配置 (S3兼容)
|
||||
type RustFSConfig struct {
|
||||
Endpoint string `mapstructure:"endpoint"`
|
||||
PublicURL string `mapstructure:"public_url"` // 公开访问URL (用于生成文件访问链接)
|
||||
AccessKey string `mapstructure:"access_key"`
|
||||
SecretKey string `mapstructure:"secret_key"`
|
||||
UseSSL bool `mapstructure:"use_ssl"`
|
||||
@@ -159,6 +160,7 @@ func setDefaults() {
|
||||
|
||||
// RustFS默认配置
|
||||
viper.SetDefault("rustfs.endpoint", "127.0.0.1:9000")
|
||||
viper.SetDefault("rustfs.public_url", "") // 为空时使用 endpoint 构建 URL
|
||||
viper.SetDefault("rustfs.use_ssl", false)
|
||||
|
||||
// JWT默认配置
|
||||
@@ -214,6 +216,7 @@ func setupEnvMappings() {
|
||||
|
||||
// RustFS配置
|
||||
viper.BindEnv("rustfs.endpoint", "RUSTFS_ENDPOINT")
|
||||
viper.BindEnv("rustfs.public_url", "RUSTFS_PUBLIC_URL")
|
||||
viper.BindEnv("rustfs.access_key", "RUSTFS_ACCESS_KEY")
|
||||
viper.BindEnv("rustfs.secret_key", "RUSTFS_SECRET_KEY")
|
||||
viper.BindEnv("rustfs.use_ssl", "RUSTFS_USE_SSL")
|
||||
|
||||
Reference in New Issue
Block a user