22 lines
517 B
Go
22 lines
517 B
Go
package filestorage
|
|
|
|
import (
|
|
"context"
|
|
"likedream-goframe/internal/common/cst"
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
var GlobalS3 *S3
|
|
|
|
func Init(ctx context.Context) {
|
|
cfg := g.Cfg()
|
|
|
|
accessKey := cfg.MustGetWithEnv(ctx, cst.ConfigS3AccessKey).String()
|
|
secretKey := cfg.MustGetWithEnv(ctx, cst.ConfigS3SecretKey).String()
|
|
baseUrl := cfg.MustGetWithEnv(ctx, cst.ConfigS3BaseUrl).String()
|
|
bucket := cfg.MustGetWithEnv(ctx, cst.ConfigS3Bucket).String()
|
|
|
|
GlobalS3 = NewS3(accessKey, secretKey, baseUrl, bucket)
|
|
}
|