check template file exists during setup

This commit is contained in:
medcl 2022-11-09 17:38:27 +08:00
parent 3bd248f80f
commit 800567363e
1 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import (
"net/http"
uri2 "net/url"
"path"
"path/filepath"
"runtime"
"github.com/valyala/fasttemplate"
log "github.com/cihub/seelog"
@ -356,6 +357,11 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
dslTplFile:=path.Join(global.Env().GetConfigDir(),"initialization.tpl")
dslFile:=path.Join(global.Env().GetConfigDir(),"initialization.dsl")
if !util.FileExists(dslTplFile){
log.Error(filepath.Abs(dslTplFile))
panic("template file for setup was missing")
}
var dsl []byte
dsl,err=util.FileGetContent(dslTplFile)
if err!=nil{