diff options
| author | Alexander Kavon <hawk@alexkavon.com> | 2023-11-27 17:52:06 -0500 |
|---|---|---|
| committer | Alexander Kavon <hawk@alexkavon.com> | 2023-11-27 17:52:06 -0500 |
| commit | 21fb29d0eec71f3dd7c12e260af5925d452b238f (patch) | |
| tree | 5252b9d0b07a0aa64de2b20680c0ef4283433143 /src/conf/conf.go | |
| parent | 1d05f918887e9ba4576149513e5df0bb57e6bd72 (diff) | |
template files for registration page, updated cwd handling, included cwd and config file path in conf struct
Diffstat (limited to 'src/conf/conf.go')
| -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 +} |
