diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-09-20 19:07:03 +0200 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-09-20 10:07:03 -0700 |
commit | a08df883b4ddb514d53b518f41431ce7efb50d8f (patch) | |
tree | 9e16aeb09188f4aa34b268b77d78e7ebaa5a5978 /utils/file_backend.go | |
parent | f1be975d7ab17a7da89ddb3cf6fea2c1b282a89e (diff) | |
download | chat-a08df883b4ddb514d53b518f41431ce7efb50d8f.tar.gz chat-a08df883b4ddb514d53b518f41431ce7efb50d8f.tar.bz2 chat-a08df883b4ddb514d53b518f41431ce7efb50d8f.zip |
Move file backend to its own service (#9435)
* Move file backend to its own service
* Moving utils/inbucket to mailservice package
Diffstat (limited to 'utils/file_backend.go')
-rw-r--r-- | utils/file_backend.go | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/utils/file_backend.go b/utils/file_backend.go deleted file mode 100644 index 368e1ba28..000000000 --- a/utils/file_backend.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package utils - -import ( - "io" - "net/http" - - "github.com/mattermost/mattermost-server/model" -) - -type FileBackend interface { - TestConnection() *model.AppError - - Reader(path string) (io.ReadCloser, *model.AppError) - ReadFile(path string) ([]byte, *model.AppError) - FileExists(path string) (bool, *model.AppError) - CopyFile(oldPath, newPath string) *model.AppError - MoveFile(oldPath, newPath string) *model.AppError - WriteFile(fr io.Reader, path string) (int64, *model.AppError) - RemoveFile(path string) *model.AppError - - ListDirectory(path string) (*[]string, *model.AppError) - RemoveDirectory(path string) *model.AppError -} - -func NewFileBackend(settings *model.FileSettings, enableComplianceFeatures bool) (FileBackend, *model.AppError) { - switch *settings.DriverName { - case model.IMAGE_DRIVER_S3: - return &S3FileBackend{ - endpoint: settings.AmazonS3Endpoint, - accessKey: settings.AmazonS3AccessKeyId, - secretKey: settings.AmazonS3SecretAccessKey, - secure: settings.AmazonS3SSL == nil || *settings.AmazonS3SSL, - signV2: settings.AmazonS3SignV2 != nil && *settings.AmazonS3SignV2, - region: settings.AmazonS3Region, - bucket: settings.AmazonS3Bucket, - encrypt: settings.AmazonS3SSE != nil && *settings.AmazonS3SSE && enableComplianceFeatures, - trace: settings.AmazonS3Trace != nil && *settings.AmazonS3Trace, - }, nil - case model.IMAGE_DRIVER_LOCAL: - return &LocalFileBackend{ - directory: settings.Directory, - }, nil - } - return nil, model.NewAppError("NewFileBackend", "api.file.no_driver.app_error", nil, "", http.StatusInternalServerError) -} |