From 2f24e49ff67e998bcb72e0ea55613f7a48f258ab Mon Sep 17 00:00:00 2001 From: MetaCubeX Date: Wed, 16 Mar 2022 21:47:00 +0800 Subject: [PATCH] [build test] 1.18 --- config/initial.go | 10 ++++++++++ main.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/initial.go b/config/initial.go index c312c4d0..0ad5673a 100644 --- a/config/initial.go +++ b/config/initial.go @@ -146,6 +146,16 @@ func Init(dir string) error { f.Write([]byte(`mixed-port: 7890`)) f.Close() } + buf, _ := os.ReadFile(C.Path.Config()) + rawCfg, err := UnmarshalRawConfig(buf) + if err != nil { + log.Errorln(err.Error()) + fmt.Printf("configuration file %s test failed\n", C.Path.Config()) + os.Exit(1) + } + if !C.GeodataMode { + C.GeodataMode = rawCfg.GeodataMode + } // initial GeoIP if err := initGeoIP(); err != nil { return fmt.Errorf("can't initial GeoIP: %w", err) diff --git a/main.go b/main.go index 4ba72960..60a20809 100644 --- a/main.go +++ b/main.go @@ -73,7 +73,7 @@ func main() { C.SetConfig(configFile) } - if geodataMode || executor.GetGeneral().GeodataMode { + if geodataMode { C.GeodataMode = true }