|
|
@@ -1,6 +1,7 @@ |
|
|
|
package comm |
|
|
|
|
|
|
|
import ( |
|
|
|
"applet/app/cfg" |
|
|
|
"applet/app/db" |
|
|
|
"applet/app/e" |
|
|
|
"applet/app/md" |
|
|
@@ -14,6 +15,7 @@ import ( |
|
|
|
"fmt" |
|
|
|
"github.com/aliyun/aliyun-oss-go-sdk/oss" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"os" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
@@ -57,6 +59,10 @@ func GetOssUrl(c *gin.Context) { |
|
|
|
ossBucketScheme := cfgMap[enum2.AliyunOssBucketScheme] |
|
|
|
accessKeyID := cfgMap[enum2.AliyunOssAccessKeyID] |
|
|
|
accessKeySecret := cfgMap[enum2.AliyunOssAccessKeySecret] |
|
|
|
if cfg.Prd { |
|
|
|
accessKeyID = os.Getenv(enum2.AliyunOssAccessKeyID) |
|
|
|
accessKeySecret = os.Getenv(enum2.AliyunOssAccessKeySecret) |
|
|
|
} |
|
|
|
|
|
|
|
// 创建OSSClient实例。 |
|
|
|
client, err := oss.New(ossBucketScheme+"://"+endpoint, accessKeyID, accessKeySecret) |
|
|
|