From 529eb46ea01f393fd663aefbf4904af544d80359 Mon Sep 17 00:00:00 2001 From: pocketW <104479902+pocketW@users.noreply.github.com> Date: Tue, 23 Aug 2022 11:20:33 +1000 Subject: [PATCH] chore: add hints for config file doc: add some badges --- README.md | 3 +++ main/main.go | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cf14aaa..6745d33 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/main/main.go b/main/main.go index 4347cc4..a6b3c34 100644 --- a/main/main.go +++ b/main/main.go @@ -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() }