mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-21 20:56:04 +03:00
Endpoint field for aws config
* endpoint fields for aws config * fix for linter * fix for demo in the readme
This commit is contained in:
parent
604e6fda58
commit
54326b4193
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -19,8 +19,14 @@ jobs:
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Go 1.17
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '1.17'
|
||||
- name: Get dependencies
|
||||
run: go mod tidy
|
||||
- name: Lint code with golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: v1.42.1
|
||||
only-new-issues: true
|
||||
|
@ -23,7 +23,12 @@ import (
|
||||
|
||||
func main() {
|
||||
// Create new core.Engine instance
|
||||
app := core.New()
|
||||
app := core.New(core.AppInfo{
|
||||
Version: "v1.0",
|
||||
Commit: "bcef82e",
|
||||
Build: "v1.0-bcef82e",
|
||||
BuildDate: "1649766442",
|
||||
})
|
||||
|
||||
// Load configuration
|
||||
app.Config = core.NewConfig("config.yml")
|
||||
|
@ -57,6 +57,7 @@ type Info struct {
|
||||
type AWS struct {
|
||||
AccessKeyID string `yaml:"access_key_id"`
|
||||
SecretAccessKey string `yaml:"secret_access_key"`
|
||||
Endpoint string `yaml:"endpoint"`
|
||||
Region string `yaml:"region"`
|
||||
Bucket string `yaml:"bucket"`
|
||||
FolderName string `yaml:"folder_name"`
|
||||
|
@ -48,6 +48,7 @@ http_client:
|
||||
config_aws:
|
||||
access_key_id: key
|
||||
secret_access_key: secret
|
||||
endpoint: https://endpoint.com
|
||||
region: region
|
||||
bucket: bucket
|
||||
folder_name: folder
|
||||
@ -100,6 +101,7 @@ func (c *ConfigTest) Test_GetUpdateInterval() {
|
||||
func (c *ConfigTest) Test_GetConfigAWS() {
|
||||
assert.Equal(c.T(), "key", c.config.GetAWSConfig().AccessKeyID)
|
||||
assert.Equal(c.T(), "secret", c.config.GetAWSConfig().SecretAccessKey)
|
||||
assert.Equal(c.T(), "https://endpoint.com", c.config.GetAWSConfig().Endpoint)
|
||||
assert.Equal(c.T(), "region", c.config.GetAWSConfig().Region)
|
||||
assert.Equal(c.T(), "bucket", c.config.GetAWSConfig().Bucket)
|
||||
assert.Equal(c.T(), "folder", c.config.GetAWSConfig().FolderName)
|
||||
|
@ -185,6 +185,10 @@ func (u *Utils) UploadUserAvatar(url string) (picURLs3 string, err error) {
|
||||
Region: aws.String(u.AWS.Region),
|
||||
}
|
||||
|
||||
if u.AWS.Endpoint != "" {
|
||||
s3Config.Endpoint = aws.String(u.AWS.Endpoint)
|
||||
}
|
||||
|
||||
s := session.Must(session.NewSession(s3Config))
|
||||
uploader := s3manager.NewUploader(s)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user