diff options
Diffstat (limited to 'src/conf')
| -rw-r--r-- | src/conf/conf.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/conf/conf.go b/src/conf/conf.go index 8abb8a8..969332a 100644 --- a/src/conf/conf.go +++ b/src/conf/conf.go @@ -9,6 +9,8 @@ import ( type ( Conf struct { + cwd string + path string Db Db `toml:"database"` Server Server `toml:"server"` } @@ -28,20 +30,22 @@ type ( func NewConf() *Conf { - workingdir, err := os.Getwd() + cwd, err := os.Getwd() if err != nil { log.Fatal(err) } filepath := os.Getenv("NEWSSTAND_CONFIG_PATH") if filepath == "" { - filepath = workingdir + "/.newsstandrc.toml" + filepath = cwd + "/.newsstandrc.toml" } log.Printf("Config file path: %s", filepath) c := Conf{ + cwd, + filepath, Db{}, Server{ - TemplatePath: workingdir + "/views", + TemplatePath: cwd + "/ui", }, } _, err = toml.DecodeFile(filepath, &c) @@ -52,3 +56,11 @@ func NewConf() *Conf { return &c } + +func (c *Conf) GetCwd() string { + return c.cwd +} + +func (c *Conf) GetPath() string { + return c.path +} |
