mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-06-08 13:29:54 +00:00
chore: add hints for config file
doc: add some badges
This commit is contained in:
parent
2a528070bf
commit
529eb46ea0
@ -1,6 +1,9 @@
|
|||||||
# XrayR
|
# XrayR
|
||||||
[](https://t.me/XrayR_project)
|
[](https://t.me/XrayR_project)
|
||||||
[](https://t.me/XrayR_channel)
|
[](https://t.me/XrayR_channel)
|
||||||
|

|
||||||
|

|
||||||
|
[]()
|
||||||
|
|
||||||
A Xray backend framework that can easily support many panels.
|
A Xray backend framework that can easily support many panels.
|
||||||
|
|
||||||
|
10
main/main.go
10
main/main.go
@ -56,7 +56,7 @@ func getConfig() *viper.Viper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := config.ReadInConfig(); err != nil {
|
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
|
config.WatchConfig() // Watch the config
|
||||||
@ -73,7 +73,9 @@ func main() {
|
|||||||
|
|
||||||
config := getConfig()
|
config := getConfig()
|
||||||
panelConfig := &panel.Config{}
|
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)
|
p := panel.New(panelConfig)
|
||||||
lastTime := time.Now()
|
lastTime := time.Now()
|
||||||
config.OnConfigChange(func(e fsnotify.Event) {
|
config.OnConfigChange(func(e fsnotify.Event) {
|
||||||
@ -84,7 +86,9 @@ func main() {
|
|||||||
p.Close()
|
p.Close()
|
||||||
// Delete old instance and trigger GC
|
// Delete old instance and trigger GC
|
||||||
runtime.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()
|
p.Start()
|
||||||
lastTime = time.Now()
|
lastTime = time.Now()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user