From 8d6d7494cf0f9c0f14b5082820082e85576a41da Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Mon, 18 Sep 2017 17:46:09 +0200 Subject: Improved syncthing binary path detection. Signed-off-by: Sebastien Douheret --- lib/xdsconfig/fileconfig.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/xdsconfig') diff --git a/lib/xdsconfig/fileconfig.go b/lib/xdsconfig/fileconfig.go index 2795206..1ad2ea3 100644 --- a/lib/xdsconfig/fileconfig.go +++ b/lib/xdsconfig/fileconfig.go @@ -75,11 +75,13 @@ func updateConfigFromFile(c *Config, confFile string) (*FileConfig, error) { } // Support environment variables (IOW ${MY_ENV_VAR} syntax) in agent-config.json - for _, field := range []*string{ + vars := []*string{ &fCfg.LogsDir, - &fCfg.SThgConf.Home, - &fCfg.SThgConf.BinDir} { - + } + if fCfg.SThgConf != nil { + vars = append(vars, &fCfg.SThgConf.Home, &fCfg.SThgConf.BinDir) + } + for _, field := range vars { var err error *field, err = common.ResolveEnvVar(*field) if err != nil { -- cgit