[MM-53113] cmd/mattermost/db: remove app dependency from db reset command (#23727)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
10cf522a5f
Коммит
de61b9b687
@@ -4,12 +4,15 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/app"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/app/request"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store/sqlstore"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/utils"
|
||||
"github.com/mattermost/mattermost/server/v8/config"
|
||||
)
|
||||
@@ -52,3 +55,14 @@ func initDBCommandContext(configDSN string, readOnlyConfigStore bool, options ..
|
||||
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func initStoreCommandContextCobra(command *cobra.Command) (store.Store, error) {
|
||||
cfgDSN := getConfigDSN(command, config.GetEnvironment())
|
||||
cfgStore, err := config.NewStoreFromDSN(cfgDSN, true, nil, true)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to load configuration")
|
||||
}
|
||||
|
||||
config := cfgStore.Get()
|
||||
return sqlstore.New(config.SqlSettings, nil), nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user