🎇 add local config

This commit is contained in:
微凉
2021-12-20 23:56:17 +08:00
parent 337bf08cd3
commit 1485ab2677
4 changed files with 17 additions and 7 deletions

View File

@ -10,11 +10,16 @@ import (
"net/http"
)
func init() {
index, err := public.Public.Open("index.html")
func InitIndex() {
var index fs.File
var err error
if conf.Conf.Local {
index, err = public.Public.Open("local.html")
} else {
index, err = public.Public.Open("index.html")
}
if err != nil {
log.Errorf(err.Error())
log.Fatalf(err.Error())
return
}
data, _ := ioutil.ReadAll(index)
@ -22,6 +27,7 @@ func init() {
}
func Static(r *gin.Engine) {
InitIndex()
assets, err := fs.Sub(public.Public, "assets")
if err != nil {
log.Fatalf("can't find assets folder")