Skip to content

Commit

Permalink
Improve oss key names.
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Apr 27, 2021
1 parent f0ffacb commit 3437885
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
4 changes: 2 additions & 2 deletions conf/oss.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[provider]
accessid = id
accesskey = key
accessId = id
accessKey = key
bucket = bucket
endpoint = endpoint
39 changes: 20 additions & 19 deletions object/oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand All @@ -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 ""
}
Expand Down

0 comments on commit 3437885

Please sign in to comment.