feat: rm uname
This commit is contained in:
@@ -119,12 +119,16 @@ func GetPolicyURL(ctx context.Context, path string) (string, error) {
|
|||||||
// DownloadFile downloads a file from OSS and returns the reader, caller should close the reader
|
// DownloadFile downloads a file from OSS and returns the reader, caller should close the reader
|
||||||
func DownloadFile(ctx context.Context, ossPath string) (io.ReadCloser, error) {
|
func DownloadFile(ctx context.Context, ossPath string) (io.ReadCloser, error) {
|
||||||
endpoint := config.GlobalConfig.Aliyun.OSS.InnerEndpoint
|
endpoint := config.GlobalConfig.Aliyun.OSS.InnerEndpoint
|
||||||
|
useCname := false
|
||||||
if config.GlobalConfig.Server.IsDebug() {
|
if config.GlobalConfig.Server.IsDebug() {
|
||||||
endpoint = config.GlobalConfig.Aliyun.OSS.Endpoint
|
endpoint = config.GlobalConfig.Aliyun.OSS.Endpoint
|
||||||
|
useCname = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Info(ctx, "func", "DownloadFile", "msg", "endpoint", endpoint, "ossPath", ossPath)
|
||||||
|
|
||||||
// Create OSS client
|
// Create OSS client
|
||||||
client, err := oss.New(endpoint, config.GlobalConfig.Aliyun.OSS.AccessKeyID, config.GlobalConfig.Aliyun.OSS.AccessKeySecret, oss.UseCname(true))
|
client, err := oss.New(endpoint, config.GlobalConfig.Aliyun.OSS.AccessKeyID, config.GlobalConfig.Aliyun.OSS.AccessKeySecret, oss.UseCname(useCname))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(ctx, "func", "DownloadFile", "msg", "create oss client failed", "error", err)
|
log.Error(ctx, "func", "DownloadFile", "msg", "create oss client failed", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user