server/public/ -- pre-requisite changes (#23278)
* invert depdendency: filestore -> model
* markdown: nolint:misspell
* inline jsonutils within model
* push model.GetInfoForBytes -> channels/app
* push channel/utils.CompileGo* -> plugin/utils
* push plugin/scheduler -> channels/jobs/plugins
* push utils.Copy(File|Dir) -> model
* oauthproiders/gitlab -> channels/app/oauthproviders/gitlab
* decouple plugin from einterfaces.MetricsInterface
* fix TestGetInfoForFile
* Revert "Run golangci in server CI (#23240)"
This reverts commit 349e5d4573.
* add model/utils
---------
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5c28071fb3
Коммит
f28a2bcca7
@@ -8,6 +8,7 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost-server/server/v8/model"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@@ -57,6 +58,30 @@ type FileBackendSettings struct {
|
||||
AmazonS3RequestTimeoutMilliseconds int64
|
||||
}
|
||||
|
||||
func NewFileBackendSettingsFromConfig(fileSettings *model.FileSettings, enableComplianceFeature bool, skipVerify bool) FileBackendSettings {
|
||||
if *fileSettings.DriverName == model.ImageDriverLocal {
|
||||
return FileBackendSettings{
|
||||
DriverName: *fileSettings.DriverName,
|
||||
Directory: *fileSettings.Directory,
|
||||
}
|
||||
}
|
||||
return FileBackendSettings{
|
||||
DriverName: *fileSettings.DriverName,
|
||||
AmazonS3AccessKeyId: *fileSettings.AmazonS3AccessKeyId,
|
||||
AmazonS3SecretAccessKey: *fileSettings.AmazonS3SecretAccessKey,
|
||||
AmazonS3Bucket: *fileSettings.AmazonS3Bucket,
|
||||
AmazonS3PathPrefix: *fileSettings.AmazonS3PathPrefix,
|
||||
AmazonS3Region: *fileSettings.AmazonS3Region,
|
||||
AmazonS3Endpoint: *fileSettings.AmazonS3Endpoint,
|
||||
AmazonS3SSL: fileSettings.AmazonS3SSL == nil || *fileSettings.AmazonS3SSL,
|
||||
AmazonS3SignV2: fileSettings.AmazonS3SignV2 != nil && *fileSettings.AmazonS3SignV2,
|
||||
AmazonS3SSE: fileSettings.AmazonS3SSE != nil && *fileSettings.AmazonS3SSE && enableComplianceFeature,
|
||||
AmazonS3Trace: fileSettings.AmazonS3Trace != nil && *fileSettings.AmazonS3Trace,
|
||||
AmazonS3RequestTimeoutMilliseconds: *fileSettings.AmazonS3RequestTimeoutMilliseconds,
|
||||
SkipVerify: skipVerify,
|
||||
}
|
||||
}
|
||||
|
||||
func (settings *FileBackendSettings) CheckMandatoryS3Fields() error {
|
||||
if settings.AmazonS3Bucket == "" {
|
||||
return errors.New("missing s3 bucket settings")
|
||||
|
||||
Ссылка в новой задаче
Block a user