add skip to initialize api
This commit is contained in:
parent
e607254cc4
commit
9a91ca7b70
|
@ -80,6 +80,7 @@ type SetupRequest struct {
|
|||
Password string `json:"password"`
|
||||
} `json:"cluster"`
|
||||
|
||||
Skip bool `json:"skip"`
|
||||
BootstrapUsername string `json:"bootstrap_username"`
|
||||
BootstrapPassword string `json:"bootstrap_password"`
|
||||
}
|
||||
|
@ -336,6 +337,7 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
|||
handler := elastic2.ElasticORM{Client: client, Config:cfg1 }
|
||||
orm.Register("elastic_setup_"+util.GetUUID(), handler)
|
||||
|
||||
if !request.Skip{
|
||||
//处理模版
|
||||
elastic2.InitTemplate(true)
|
||||
|
||||
|
@ -388,7 +390,6 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//处理索引
|
||||
elastic2.InitSchema()
|
||||
//init security
|
||||
|
@ -426,6 +427,15 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
|||
}
|
||||
|
||||
|
||||
//disable builtin auth
|
||||
err=api.DisableBuiltinUserAdmin()
|
||||
if err!=nil{
|
||||
panic(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//save to local file
|
||||
file:=path.Join(global.Env().GetConfigDir(),"system_config.yml")
|
||||
_,err=util.FilePutContent(file,fmt.Sprintf("configs.template:\n - name: \"system\"\n path: ./config/system_config.tpl\n variable:\n " +
|
||||
|
@ -436,17 +446,9 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
|||
panic(err)
|
||||
}
|
||||
|
||||
//处理 ILM
|
||||
|
||||
//callback
|
||||
InvokeSetupCallback()
|
||||
|
||||
//disable builtin auth
|
||||
err=api.DisableBuiltinUserAdmin()
|
||||
if err!=nil{
|
||||
panic(err)
|
||||
}
|
||||
|
||||
//place setup lock file
|
||||
setupLock:=path.Join(global.Env().GetDataDir(),".setup_lock")
|
||||
_,err=util.FilePutContent(setupLock,time.Now().String())
|
||||
|
|
Loading…
Reference in New Issue