summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
authorJonathan <jonfritz@gmail.com>2017-12-07 15:56:14 -0500
committerGitHub <noreply@github.com>2017-12-07 15:56:14 -0500
commitef597f6fe45cae8b3ba405ff89f5b20bfbf349e5 (patch)
tree612629dd3ee1b3badf17ccd90cd4d37228044b24 /model/config.go
parent98620d5aa37b117b0e1d3bd3402d24f610bf8a3f (diff)
downloadchat-ef597f6fe45cae8b3ba405ff89f5b20bfbf349e5.tar.gz
chat-ef597f6fe45cae8b3ba405ff89f5b20bfbf349e5.tar.bz2
chat-ef597f6fe45cae8b3ba405ff89f5b20bfbf349e5.zip
PLT-8314: Test Message Export Against S3 Bucket (#7957)
* Removed export directory config setting, in favour of hard-coding it to an 'export' directory under the local file directory. Improved the local file backend copy implementation to implicitly create the destination directory if it's missing * Fixed the tests
Diffstat (limited to 'model/config.go')
-rw-r--r--model/config.go21
1 files changed, 4 insertions, 17 deletions
diff --git a/model/config.go b/model/config.go
index ac1d034d4..544f9b33f 100644
--- a/model/config.go
+++ b/model/config.go
@@ -8,7 +8,6 @@ import (
"io"
"net/http"
"net/url"
- "path/filepath"
"strings"
"time"
)
@@ -25,6 +24,10 @@ const (
DATABASE_DRIVER_MYSQL = "mysql"
DATABASE_DRIVER_POSTGRES = "postgres"
+ MINIO_ACCESS_KEY = "minioaccesskey"
+ MINIO_SECRET_KEY = "miniosecretkey"
+ MINIO_BUCKET = "mattermost-test"
+
PASSWORD_MAXIMUM_LENGTH = 64
PASSWORD_MINIMUM_LENGTH = 5
@@ -1523,7 +1526,6 @@ type MessageExportSettings struct {
EnableExport *bool
DailyRunTime *string
ExportFromTimestamp *int64
- FileLocation *string
BatchSize *int
}
@@ -1532,10 +1534,6 @@ func (s *MessageExportSettings) SetDefaults() {
s.EnableExport = NewBool(false)
}
- if s.FileLocation == nil {
- s.FileLocation = NewString("export")
- }
-
if s.DailyRunTime == nil {
s.DailyRunTime = NewString("01:00")
}
@@ -2064,19 +2062,8 @@ func (mes *MessageExportSettings) isValid(fs FileSettings) *AppError {
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.daily_runtime.app_error", nil, "", http.StatusBadRequest)
} else if _, err := time.Parse("15:04", *mes.DailyRunTime); err != nil {
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.daily_runtime.app_error", nil, err.Error(), http.StatusBadRequest)
- } else if mes.FileLocation == nil {
- return NewAppError("Config.IsValid", "model.config.is_valid.message_export.file_location.app_error", nil, "", http.StatusBadRequest)
} else if mes.BatchSize == nil || *mes.BatchSize < 0 {
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.batch_size.app_error", nil, "", http.StatusBadRequest)
- } else if *fs.DriverName != IMAGE_DRIVER_LOCAL {
- if absFileDir, err := filepath.Abs(fs.Directory); err != nil {
- return NewAppError("Config.IsValid", "model.config.is_valid.message_export.file_location.relative", nil, err.Error(), http.StatusBadRequest)
- } else if absMessageExportDir, err := filepath.Abs(*mes.FileLocation); err != nil {
- return NewAppError("Config.IsValid", "model.config.is_valid.message_export.file_location.relative", nil, err.Error(), http.StatusBadRequest)
- } else if !strings.HasPrefix(absMessageExportDir, absFileDir) {
- // configured export directory must be relative to data directory
- return NewAppError("Config.IsValid", "model.config.is_valid.message_export.file_location.relative", nil, "", http.StatusBadRequest)
- }
}
}
return nil