Files
huangguo_server/common/handleCong.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

26 lines
646 B
Go

package common
import "errors"
// FsOption 读取文件服务器配置
type FsOption struct {
BucketName string `json:"bucketName"`
AccessKey string `json:"accessKey"`
Secret string `json:"secret"`
TTL string `json:"ttl"`
}
// SelectFsOption 从配置文件中读取Bucket对应的相关值
func SelectFsOption(bucket string, FsOptions []FsOption) (FsOption, error) {
option := FsOption{}
if bucket == "" || len(FsOptions) == 0 {
return option, errors.New("bucket or FsOptions must nor be empty")
}
for _, option := range FsOptions {
if option.BucketName == bucket {
return option, nil
}
}
return option, nil
}