add global config support

This commit is contained in:
wjqserver 2025-06-30 15:31:14 +08:00
parent cd1e1a42f3
commit 34d553a890
23 changed files with 1682 additions and 343 deletions

View file

@ -33,7 +33,7 @@ func init() {
parseFlags()
loadConfig()
loadDatabase(cfg.DB.Filepath)
loadtmpltoDB(cfg.Tmpl.Path, cdb)
loadtmpltoDB(cfg.Server.CaddyDir+"tmpl", cdb)
loadAdminStatus(cdb)
initSessionKey()
}
@ -89,6 +89,11 @@ func loadtmpltoDB(path string, cdb *db.ConfigDB) {
fmt.Printf("Failed to load templates: %v\n", err)
os.Exit(1)
}
err = gen.SetGlobalConfig(cfg, cdb)
if err != nil {
fmt.Printf("Failed to set global config: %v\n", err)
os.Exit(1)
}
err = gen.Add80SiteConfig(cfg, cdb)
if err != nil {
fmt.Printf("Failed to add :80 site config: %v\n", err)