From 4982769bd48b5c67c5eff4d9c6f297fa2a7531a4 Mon Sep 17 00:00:00 2001 From: Clément Bénier Date: Mon, 15 Oct 2018 14:31:33 +0200 Subject: fileconfig: env variables after default values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolv env variables after setting default values if needed obviously, it will also resolv default values so it will fix EXEPATH bug Change-Id: If334d44374d021f9439288a46ed5827ea3b9fbe2 Signed-off-by: Clément Bénier --- lib/xdsconfig/fileconfig.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/xdsconfig/fileconfig.go b/lib/xdsconfig/fileconfig.go index b786a24..374afa3 100644 --- a/lib/xdsconfig/fileconfig.go +++ b/lib/xdsconfig/fileconfig.go @@ -122,13 +122,6 @@ func readGlobalConfig(c *Config, confFile string) error { if fCfg.SThgConf != nil { vars = append(vars, &fCfg.SThgConf.Home, &fCfg.SThgConf.BinDir) } - for _, field := range vars { - var err error - if *field, err = common.ResolveEnvVar(*field); err != nil { - return err - } - } - // Use config file settings else use default config if fCfg.WebAppDir == "" { fCfg.WebAppDir = c.FileConf.WebAppDir @@ -149,6 +142,13 @@ func readGlobalConfig(c *Config, confFile string) error { fCfg.LogsDir = c.FileConf.LogsDir } + for _, field := range vars { + var err error + if *field, err = common.ResolveEnvVar(*field); err != nil { + return err + } + } + // Resolve webapp dir (support relative or full path) fCfg.WebAppDir = strings.Trim(fCfg.WebAppDir, " ") if !strings.HasPrefix(fCfg.WebAppDir, "/") && exePath != "" { -- cgit 1.2.3-korg