[MM-53454] Add export file settings + slash command for public link (#23915)
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -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
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user