mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
add watch config option
This commit is contained in:
parent
baab76d667
commit
72936370e7
3
main.go
3
main.go
@ -15,6 +15,7 @@ import (
|
||||
|
||||
var (
|
||||
configFile = flag.String("config", "/etc/V2bX/config.yml", "Config file for V2bX.")
|
||||
watch = flag.Bool("watch", true, "Watch config file for changes.")
|
||||
printVersion = flag.Bool("version", false, "show version")
|
||||
)
|
||||
|
||||
@ -51,6 +52,7 @@ func main() {
|
||||
if err != nil {
|
||||
log.Panicf("run nodes error: %s", err)
|
||||
}
|
||||
if *watch {
|
||||
err = config.Watch(*configFile, func() {
|
||||
nodes.Close()
|
||||
err = x.Restart(config)
|
||||
@ -66,6 +68,7 @@ func main() {
|
||||
if err != nil {
|
||||
log.Panicf("watch config file error: %s", err)
|
||||
}
|
||||
}
|
||||
//Explicitly triggering GC to remove garbage from config loading.
|
||||
runtime.GC()
|
||||
// Running backend
|
||||
|
@ -1,4 +1,3 @@
|
||||
// Package node the InbounderConfig used by add inbound
|
||||
package controller
|
||||
|
||||
import (
|
||||
|
Loading…
Reference in New Issue
Block a user