Skip to content

Commit a415a0e

Browse files
fix: fixed paths for config
Signed-off-by: Ricky Moorhouse <[email protected]>
1 parent b18f1cb commit a415a0e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

exporter.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"nets/manager"
1616
"os"
1717
"path/filepath"
18-
"strings"
1918
"time"
2019

2120
"github.com/IBM/alchemy-logging/src/go/alog"
@@ -64,17 +63,14 @@ type CertReloader struct {
6463
func ReadConfig() Config {
6564
var config Config
6665

67-
config_path := os.Getenv("CONFIG_PATH")
68-
if config_path == "" {
69-
config_path = "config.yaml"
66+
config_path := "config.yaml"
67+
// If the config/config.yaml exists then use the config instead
68+
_, err := os.Stat("config/config.yaml")
69+
if !os.IsNotExist(err) {
70+
config_path = "config/config.yaml"
7071
}
7172

7273
log.Log(alog.INFO, "Loading config from %s ", config_path)
73-
74-
// Block paths starting with '/' or containing '..'
75-
if strings.Contains(config_path, "..") {
76-
log.Log(alog.ERROR, "invalid config path: %s", config_path)
77-
}
7874
// Open YAML file
7975
file, err := os.Open(filepath.Clean(config_path))
8076
if err != nil {

0 commit comments

Comments
 (0)