|
|
|
@ -13,6 +13,7 @@ import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/minio/minio-go/v7"
|
|
|
|
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
|
|
|
|
"net/http"
|
|
|
|
|
"path"
|
|
|
|
|
"strings"
|
|
|
|
@ -108,8 +109,12 @@ func UploadUpdateApp(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
fmt.Println(req.OperationID, utils.GetSelfFuncName(), "name: ", config.Config.Credential.Minio.AppBucket, newFileName, fileObj, file.Size)
|
|
|
|
|
fmt.Println(req.OperationID, utils.GetSelfFuncName(), "name: ", config.Config.Credential.Minio.AppBucket, newYamlName, yamlObj, yaml.Size)
|
|
|
|
|
minioClient, err := minio.New(config.Config.Credential.Minio.EndpointInner, &minio.Options{
|
|
|
|
|
Creds: credentials.NewStaticV4(config.Config.Credential.Minio.AccessKeyID, config.Config.Credential.Minio.SecretAccessKey, ""),
|
|
|
|
|
Secure: false,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
_, err = apiThird.MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newFileName, fileObj, file.Size, minio.PutObjectOptions{ContentType: path.Ext(newFileName)})
|
|
|
|
|
_, err = minioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newFileName, fileObj, file.Size, minio.PutObjectOptions{ContentType: path.Ext(newFileName)})
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "PutObject file error")
|
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "PutObject file error" + err.Error()})
|
|
|
|
|