Merge pull request #2368 from vcptr/fixincomp

fix config compatibility with old inbound/inboundDetors/out
pull/2374/head
Kslr 2020-03-24 18:32:22 +08:00 committed by GitHub
commit afb82443e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -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 {

View File

@ -62,9 +62,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
}
}
}