From 0fd0c374c11b090bdee6a5843d0e9042d4db7a46 Mon Sep 17 00:00:00 2001 From: vcptr <51714622+vcptr@users.noreply.github.com> Date: Tue, 24 Mar 2020 13:47:07 +0800 Subject: [PATCH] fix config compatibility with old inbound/inboundDetors/out --- infra/conf/v2ray.go | 15 +++++++++++++++ main/main.go | 3 --- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/infra/conf/v2ray.go b/infra/conf/v2ray.go index 56c1a2a49..8f0d7d1a7 100644 --- a/infra/conf/v2ray.go +++ b/infra/conf/v2ray.go @@ -360,6 +360,21 @@ func (c *Config) Override(o *Config, fn string) { c.Reverse = o.Reverse } + // deprecated attrs... keep them for now + if o.InboundConfig != nil { + c.InboundConfig = o.InboundConfig + } + if o.OutboundConfig != nil { + c.OutboundConfig = o.OutboundConfig + } + if o.InboundDetours != nil { + c.InboundDetours = o.InboundDetours + } + if o.OutboundDetours != nil { + c.OutboundDetours = o.OutboundDetours + } + // deprecated attrs + // update the Inbound in slice if the only one in overide config has same tag if len(o.InboundConfigs) > 0 { if len(c.InboundConfigs) > 0 && len(o.InboundConfigs) == 1 { diff --git a/main/main.go b/main/main.go index 6ed012aec..fe13c3d1c 100644 --- a/main/main.go +++ b/main/main.go @@ -74,9 +74,6 @@ func getConfigFilePath() (cmdarg.Arg, error) { if envConfDir := platform.GetConfDirPath(); dirExists(envConfDir) { log.Println("Using confdir from env:", envConfDir) readConfDir(envConfDir) - if len(configFiles) > 0 { - return configFiles, nil - } } }