Przeglądaj źródła

use cwd instead of hardcoded path for config

reid 2 lat temu
rodzic
commit
b40968ba09
1 zmienionych plików z 5 dodań i 0 usunięć
  1. 5 0
      config/config.go

+ 5 - 0
config/config.go

@@ -38,6 +38,11 @@ var (
 // try initializing from system.json on disk
 func init() {
 	// try loading existing config
+	basePath, err := os.Getwd()
+	if err != nil {
+		errmsg := fmt.Sprintf("Couldn't get cwd: %v",err)
+		logger.Error(errmsg)
+	}
 	confPath := filepath.Join(basePath, "settings", "system.json")
 	file, err := os.Open(confPath)
 	if err != nil {