Make template directory configurable from config.json
This commit is contained in:
parent
4c6b88d530
commit
4d08ee53b0
|
@ -11,6 +11,7 @@ type Config struct {
|
|||
Address string
|
||||
DBpath string
|
||||
StoreDir string
|
||||
HTMLTemplateDir string
|
||||
UrlPrefix string
|
||||
IdLen int
|
||||
AuthKeyLen int
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"io"
|
||||
"html/template"
|
||||
"time"
|
||||
|
||||
"git.fuwafuwa.moe/x3/ngfshare/config"
|
||||
)
|
||||
|
||||
var tmpl *template.Template
|
||||
|
@ -32,7 +34,7 @@ func addFuncs(t *template.Template) *template.Template {
|
|||
}
|
||||
|
||||
func LoadTemplates() error {
|
||||
t, err := addFuncs(template.New("")).ParseGlob("./templates/*")
|
||||
t, err := addFuncs(template.New("")).ParseGlob(fmt.Sprintf("%s/*", config.Conf.HTMLTemplateDir))
|
||||
if err != nil {
|
||||
log.Println("LoadTemplates:", err)
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue