diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/auth/routes.go | 4 | ||||
| -rw-r--r-- | src/conf/conf.go | 18 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/auth/routes.go b/src/auth/routes.go index 796d123..4f161de 100644 --- a/src/auth/routes.go +++ b/src/auth/routes.go @@ -25,7 +25,7 @@ func Register(s *server.Server) http.HandlerFunc { if err != nil { log.Fatal(err) } - tmpl := template.Must(template.ParseFiles(cwd + "/views/templates/main.tmpl.html")) - tmpl.Execute(w, nil) + tmpl := template.Must(template.ParseFiles(cwd+"/ui/templates/base.tmpl.html", cwd+"/ui/pages/auth/register.tmpl.html")) + tmpl.ExecuteTemplate(w, "base", nil) } } 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 +} |
