Improve oss key names.

This commit is contained in:
Yang Luo 2021-04-27 18:11:41 +08:00
parent f0ffacb6a5
commit 3437885723
3 changed files with 24 additions and 23 deletions

View File

@ -213,8 +213,8 @@ Now, Casdoor is running on port 8000. You can access Casdoor pages directly in y
```
[provider]
accessid = id
accesskey = key
accessId = id
accessKey = key
bucket = bucket
endpoint = endpoint
```

View File

@ -1,5 +1,5 @@
[provider]
accessid = id
accesskey = key
accessId = id
accessKey = key
bucket = bucket
endpoint = endpoint

View File

@ -16,9 +16,10 @@ package object
import (
"bytes"
awss3 "github.com/aws/aws-sdk-go/service/s3"
"github.com/qor/oss"
"github.com/qor/oss/aliyun"
awss3 "github.com/aws/aws-sdk-go/service/s3"
//"github.com/qor/oss/qiniu"
"github.com/qor/oss/s3"
"gopkg.in/ini.v1"
@ -27,33 +28,33 @@ import (
var storage oss.StorageInterface
func AliyunInit(section *ini.Section) string {
accessID := section.Key("accessid").String()
accessKey := section.Key("accesskey").String()
accessId := section.Key("accessId").String()
accessKey := section.Key("accessKey").String()
bucket := section.Key("bucket").String()
endpoint := section.Key("endpoint").String()
if accessID == "" || accessKey == "" || bucket == "" || endpoint == "" {
if accessId == "" || accessKey == "" || bucket == "" || endpoint == "" {
return "Config oss.conf wrong"
}
storage = aliyun.New(&aliyun.Config{
AccessID: accessID,
AccessID: accessId,
AccessKey: accessKey,
Bucket: bucket,
Endpoint: endpoint,
Bucket: bucket,
Endpoint: endpoint,
})
return ""
}
//func QiniuInit(section *ini.Section) string {
// accessID := section.Key("accessid").String()
// accessKey := section.Key("accesskey").String()
// accessId := section.Key("accessId").String()
// accessKey := section.Key("accessKey").String()
// bucket := section.Key("bucket").String()
// region := section.Key("region").String()
// endpoint := section.Key("endpoint").String()
// if accessID == "" || accessKey == "" || bucket == "" || endpoint == "" || region == "" {
// if accessId == "" || accessKey == "" || bucket == "" || endpoint == "" || region == "" {
// return "Config oss.conf wrong"
// }
// storage = qiniu.New(&qiniu.Config{
// AccessID: accessID,
// AccessID: accessId,
// AccessKey: accessKey,
// Bucket: bucket,
// Region: region,
@ -63,21 +64,21 @@ func AliyunInit(section *ini.Section) string {
//}
func Awss3Init(section *ini.Section) string {
accessID := section.Key("accessid").String()
accessKey := section.Key("accesskey").String()
accessId := section.Key("accessId").String()
accessKey := section.Key("accessKey").String()
bucket := section.Key("bucket").String()
region := section.Key("region").String()
endpoint := section.Key("endpoint").String()
if accessID == "" || accessKey == "" || bucket == "" || endpoint == "" || region == "" {
if accessId == "" || accessKey == "" || bucket == "" || endpoint == "" || region == "" {
return "Config oss.conf wrong"
}
storage = s3.New(&s3.Config{
AccessID: accessID,
AccessID: accessId,
AccessKey: accessKey,
Region: region,
Bucket: bucket,
Endpoint: endpoint,
ACL: awss3.BucketCannedACLPublicRead,
Region: region,
Bucket: bucket,
Endpoint: endpoint,
ACL: awss3.BucketCannedACLPublicRead,
})
return ""
}