[MM-53454] Add export file settings + slash command for public link (#23915)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Julien Tant
2023-07-19 13:01:39 -07:00
коммит произвёл GitHub
родитель f3b1f33dff
Коммит 077c16ef61
29 изменённых файлов: 1024 добавлений и 135 удалений

Просмотреть файл

@@ -82,6 +82,13 @@ func SetFileStore(filestore filestore.FileBackend) Option {
}
}
func SetExportFileStore(filestore filestore.FileBackend) Option {
return func(ps *PlatformService) error {
ps.exportFilestore = filestore
return nil
}
}
// ConfigStore applies the given config store, typically to replace the traditional sources with a memory store for testing.
func ConfigStore(configStore *config.Store) Option {
return func(ps *PlatformService) error {

Просмотреть файл

@@ -43,7 +43,8 @@ type PlatformService struct {
configStore *config.Store
filestore filestore.FileBackend
filestore filestore.FileBackend
exportFilestore filestore.FileBackend
cacheProvider cache.Provider
statusCache cache.Cache
@@ -247,6 +248,18 @@ func New(sc ServiceConfig, options ...Option) (*PlatformService, error) {
ps.filestore = backend
}
if ps.exportFilestore == nil {
ps.exportFilestore = ps.filestore
if *ps.Config().FileSettings.DedicatedExportStore {
backend, errFileBack := filestore.NewFileBackend(filestore.NewExportFileBackendSettingsFromConfig(&ps.Config().FileSettings, license != nil && *license.Features.Compliance, false))
if errFileBack != nil {
return nil, fmt.Errorf("failed to initialize export filebackend: %w", errFileBack)
}
ps.exportFilestore = backend
}
}
var err error
ps.Store, err = ps.newStore()
if err != nil {
@@ -490,3 +503,7 @@ func (ps *PlatformService) GetPluginStatuses() (model.PluginStatuses, *model.App
func (ps *PlatformService) FileBackend() filestore.FileBackend {
return ps.filestore
}
func (ps *PlatformService) ExportFileBackend() filestore.FileBackend {
return ps.exportFilestore
}