mirror of
https://github.com/AlistGo/alist.git
synced 2025-04-22 21:04:07 +08:00
🔧 change config
This commit is contained in:
parent
55d244b726
commit
fea8b376f8
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,7 +23,7 @@ dist/
|
||||
bin/*
|
||||
/alist
|
||||
*.json
|
||||
public/index.html
|
||||
public/*.html
|
||||
public/assets/
|
||||
public/public/
|
||||
data/
|
@ -33,7 +33,7 @@ func InitConf() {
|
||||
}
|
||||
log.Debugf("config:%+v", conf.Conf)
|
||||
// update config.json struct
|
||||
confBody, err := utils.Json.Marshal(conf.Conf)
|
||||
confBody, err := utils.Json.MarshalIndent(conf.Conf, "", " ")
|
||||
if err != nil {
|
||||
log.Fatalf("marshal config error:%s", err.Error())
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ type CacheConfig struct {
|
||||
type Config struct {
|
||||
Address string `json:"address"`
|
||||
Port int `json:"port"`
|
||||
Local bool `json:"local"`
|
||||
Assets string `json:"assets"`
|
||||
Database Database `json:"database"`
|
||||
Scheme Scheme `json:"scheme"`
|
||||
Cache CacheConfig `json:"cache"`
|
||||
@ -35,6 +35,7 @@ func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Address: "0.0.0.0",
|
||||
Port: 5244,
|
||||
Assets: "jsdelivr",
|
||||
Database: Database{
|
||||
Type: "sqlite3",
|
||||
Port: 0,
|
||||
|
@ -1,6 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Xhofe/alist/conf"
|
||||
"github.com/Xhofe/alist/public"
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -14,13 +15,17 @@ import (
|
||||
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 conf.Conf.Local {
|
||||
// index, err = public.Public.Open("local.html")
|
||||
//} else {
|
||||
// index, err = public.Public.Open("index.html")
|
||||
//}
|
||||
if conf.Conf.Assets == "" {
|
||||
conf.Conf.Assets = "jsdelivr"
|
||||
}
|
||||
index, err = public.Public.Open(fmt.Sprintf("%s.html", conf.Conf.Assets))
|
||||
if err != nil {
|
||||
//log.Fatalf(err.Error())
|
||||
log.Fatalf(err.Error())
|
||||
return
|
||||
}
|
||||
data, _ := ioutil.ReadAll(index)
|
||||
|
Loading…
x
Reference in New Issue
Block a user