package init import ( "encoding/gob" "fmt" _ "github.com/beego/beego/v2/server/web/session/redis" "nginx-ui/server/config" "nginx-ui/server/db" "nginx-ui/server/models" _ "nginx-ui/server/routers" "nginx-ui/server/utils" "os" ) func ensureIndexHtml() { if !utils.IsExist("views") { os.Mkdir("views", 0777) } sourceDir := utils.GetStaticDir() utils.CopyFile(sourceDir+"/index.html", "views/index.html") } func init() { fmt.Printf("-------init---") gob.Register(models.User{}) db.Init() config.InitAdmin() fmt.Println("init success") ensureRoutes() ensureIndexHtml() }