chore: add hints for config file

doc: add some badges
This commit is contained in:
pocketW 2022-08-23 11:20:33 +10:00
parent 2a528070bf
commit 529eb46ea0
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,9 @@
# XrayR
[![](https://img.shields.io/badge/TgChat-@XrayR讨论-blue.svg)](https://t.me/XrayR_project)
[![](https://img.shields.io/badge/Channel-@XrayR通知-blue.svg)](https://t.me/XrayR_channel)
![](https://github.com/XrayR-project/XrayR/actions/workflows/release.yml/badge.svg)
![](https://github.com/XrayR-project/XrayR/actions/workflows/docker.yml/badge.svg)
[![Github All Releases](https://img.shields.io/github/downloads/XrayR-project/XrayR/total.svg)]()
A Xray backend framework that can easily support many panels.

View File

@ -56,7 +56,7 @@ func getConfig() *viper.Viper {
}
if err := config.ReadInConfig(); err != nil {
log.Panicf("Fatal error config file: %s \n", err)
log.Panicf("Config file error: %s \n", err)
}
config.WatchConfig() // Watch the config
@ -73,7 +73,9 @@ func main() {
config := getConfig()
panelConfig := &panel.Config{}
config.Unmarshal(panelConfig)
if err := config.Unmarshal(panelConfig); err != nil {
log.Panicf("Parse config file %s failed: %s \n", configFile, err)
}
p := panel.New(panelConfig)
lastTime := time.Now()
config.OnConfigChange(func(e fsnotify.Event) {
@ -84,7 +86,9 @@ func main() {
p.Close()
// Delete old instance and trigger GC
runtime.GC()
config.Unmarshal(panelConfig)
if err := config.Unmarshal(panelConfig); err != nil {
log.Panicf("Parse config file %s failed: %s \n", configFile, err)
}
p.Start()
lastTime = time.Now()
}