config: resolve file SD paths relative to config

This commit is contained in:
Fabian Reinartz 2017-07-04 11:06:02 +02:00
parent 426125298e
commit 65b087bcc1
2 changed files with 7 additions and 2 deletions

View file

@ -281,6 +281,11 @@ func resolveFilepaths(baseDir string, cfg *Config) {
consulcfg.TLSConfig.CertFile = join(consulcfg.TLSConfig.CertFile)
consulcfg.TLSConfig.KeyFile = join(consulcfg.TLSConfig.KeyFile)
}
for _, filecfg := range cfg.FileSDConfigs {
for i, fn := range filecfg.Files {
filecfg.Files[i] = join(fn)
}
}
}
for _, cfg := range cfg.ScrapeConfigs {

View file

@ -104,11 +104,11 @@ var expectedConf = &Config{
FileSDConfigs: []*FileSDConfig{
{
Files: []string{"foo/*.slow.json", "foo/*.slow.yml", "single/file.yml"},
Files: []string{"testdata/foo/*.slow.json", "testdata/foo/*.slow.yml", "testdata/single/file.yml"},
RefreshInterval: model.Duration(10 * time.Minute),
},
{
Files: []string{"bar/*.yaml"},
Files: []string{"testdata/bar/*.yaml"},
RefreshInterval: model.Duration(5 * time.Minute),
},
},