* app cleanup

* whoops, forgot a file

* some minor cleanup

* longer container deadline

* defensive checks
Этот коммит содержится в:
Chris
2017-10-09 14:59:48 -07:00
коммит произвёл GitHub
родитель 0f66b6e726
Коммит bff2b5e735
22 изменённых файлов: 165 добавлений и 166 удалений

29
app/options.go Обычный файл
Просмотреть файл

@@ -0,0 +1,29 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package app
import (
"github.com/mattermost/mattermost-server/store"
)
type Option func(a *App)
// By default, the app will use the store specified by the configuration. This allows you to
// construct an app with a different store.
//
// The storeOrFactory parameter must be either a store.Store or func() store.Store.
func StoreOverride(storeOrFactory interface{}) Option {
return func(a *App) {
switch s := storeOrFactory.(type) {
case store.Store:
a.newStore = func() store.Store {
return s
}
case func() store.Store:
a.newStore = s
default:
panic("invalid StoreOverride")
}
}
}