Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions backend/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func newComponent(ctx context.Context) (*component, error) {
cfg.AccessKeyID = getOssUser()
cfg.SecretAccessKey = getOssPassword()
cfg.Bucket = getOssBucket()
cfg.ForcePathStyle = getOssForcePathStyle()
cfg.ForcePathStyle = getOssForcePathStyle(componentConfig)
})
objectStorage, err := fileserver.NewS3Client(s3Config)
if err != nil {
Expand Down Expand Up @@ -348,7 +348,13 @@ func getOssBucket() string {
return os.Getenv("COZE_LOOP_OSS_BUCKET")
}

func getOssForcePathStyle() *bool {
func getOssForcePathStyle(componentConfig *ComponentConfig) *bool {
// 优先从配置文件读取
if componentConfig != nil && componentConfig.S3Config.ForcePathStyle != nil {
return componentConfig.S3Config.ForcePathStyle
}

// 配置文件未设置时,回退到域名判断(向后兼容)
if getOssDomain() == "coze-loop-minio" {
return gptr.Of(true)
}
Expand Down