aboutsummaryrefslogtreecommitdiff
path: root/src/conf/conf.go
diff options
context:
space:
mode:
authorAlexander Kavon <me+git@alexkavon.com>2024-01-23 06:33:20 -0500
committerAlexander Kavon <me+git@alexkavon.com>2024-01-23 06:33:20 -0500
commit8d92bdf7da95e1085485c0e60b9dac19c246e235 (patch)
tree5c346f8bdb10b3b8084a3b9e95c727f7fa3914be /src/conf/conf.go
parent8510c36ded85740885e67b59ee2ec2360986c0a9 (diff)
move ui templates into src, update conf to handle other paths, export User Insert Hooks
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)
}