remove global refs from api/api4 (#7496)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
e0d5703f72
Коммит
dcf9e96a0b
@@ -11,16 +11,15 @@ import (
|
||||
|
||||
l4g "github.com/alecthomas/log4go"
|
||||
"github.com/mattermost/mattermost-server/api"
|
||||
"github.com/mattermost/mattermost-server/app"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
"github.com/mssola/user_agent"
|
||||
)
|
||||
|
||||
func InitWeb() {
|
||||
func Init(api3 *api.API) {
|
||||
l4g.Debug(utils.T("web.init.debug"))
|
||||
|
||||
mainrouter := app.Global().Srv.Router
|
||||
mainrouter := api3.BaseRoutes.Root
|
||||
|
||||
if *utils.Cfg.ServiceSettings.WebserverMode != "disabled" {
|
||||
staticDir, _ := utils.FindDir(model.CLIENT_DIR)
|
||||
@@ -36,7 +35,7 @@ func InitWeb() {
|
||||
|
||||
mainrouter.PathPrefix("/static/plugins/").Handler(pluginHandler)
|
||||
mainrouter.PathPrefix("/static/").Handler(staticHandler)
|
||||
mainrouter.Handle("/{anything:.*}", api.AppHandlerIndependent(root)).Methods("GET")
|
||||
mainrouter.Handle("/{anything:.*}", api3.AppHandlerIndependent(root)).Methods("GET")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ func Setup() *app.App {
|
||||
a.InitStores()
|
||||
a.Srv.Router = api.NewRouter()
|
||||
a.StartServer()
|
||||
api4.InitApi(a.Srv.Router, false)
|
||||
api.InitApi(a.Srv.Router)
|
||||
InitWeb()
|
||||
api4.Init(a, a.Srv.Router, false)
|
||||
api3 := api.Init(a, a.Srv.Router)
|
||||
Init(api3)
|
||||
URL = "http://localhost" + *utils.Cfg.ServiceSettings.ListenAddress
|
||||
ApiClient = model.NewClient(URL)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user