Merge pull request #2896 from prometheus/filepath

config: resolve file SD paths relative to config
reviewable/pr2906/r1
Fabian Reinartz 8 years ago committed by GitHub
commit 496c060f98

@ -281,6 +281,11 @@ func resolveFilepaths(baseDir string, cfg *Config) {
consulcfg.TLSConfig.CertFile = join(consulcfg.TLSConfig.CertFile) consulcfg.TLSConfig.CertFile = join(consulcfg.TLSConfig.CertFile)
consulcfg.TLSConfig.KeyFile = join(consulcfg.TLSConfig.KeyFile) 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 { for _, cfg := range cfg.ScrapeConfigs {

@ -104,11 +104,11 @@ var expectedConf = &Config{
FileSDConfigs: []*FileSDConfig{ 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), RefreshInterval: model.Duration(10 * time.Minute),
}, },
{ {
Files: []string{"bar/*.yaml"}, Files: []string{"testdata/bar/*.yaml"},
RefreshInterval: model.Duration(5 * time.Minute), RefreshInterval: model.Duration(5 * time.Minute),
}, },
}, },

Loading…
Cancel
Save