aboutsummaryrefslogtreecommitdiff
path: root/src/conf/conf.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf/conf.go')
-rw-r--r--src/conf/conf.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/conf/conf.go b/src/conf/conf.go
index 62ffb57..a0852dc 100644
--- a/src/conf/conf.go
+++ b/src/conf/conf.go
@@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
+ "path/filepath"
"github.com/BurntSushi/toml"
)
@@ -39,15 +40,16 @@ func NewConf() *Conf {
if err != nil {
log.Fatal(err)
}
- filepath := os.Getenv("NEWSSTAND_CONFIG_PATH")
- if filepath == "" {
- filepath = cwd + "/.newsstandrc.toml"
+ configpath := os.Getenv("NEWSSTAND_CONFIG_PATH")
+ if configpath == "" {
+ configpath = "./.newsstandrc.toml"
}
- log.Printf("Config file path: %s", filepath)
+ confpath := filepath.Clean(filepath.Join(cwd, configpath))
+ log.Printf("Config file path: %s", confpath)
c := Conf{
cwd,
- filepath,
+ confpath,
Db{
Hostname: "localhost",
},
@@ -55,7 +57,7 @@ func NewConf() *Conf {
UiPath: cwd + "/ui",
},
}
- _, err = toml.DecodeFile(filepath, &c)
+ _, err = toml.DecodeFile(confpath, &c)
if err != nil {
log.Fatalln(err)
}