1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 10:07:02 +00:00

Add customizable greeting to index page

Allow an organization to copy the greeting.html file out of the themes
directory, customize it, then point the greeting.file config option at
it so that it will survive Inbucket upgrades.
This commit is contained in:
James Hillyerd
2013-10-10 14:04:22 -07:00
parent dcc5d240cb
commit 97a2016177
8 changed files with 43 additions and 9 deletions

View File

@@ -3,12 +3,20 @@ package web
import (
"fmt"
"github.com/jhillyerd/inbucket/config"
"html/template"
"io/ioutil"
"net/http"
)
func RootIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err error) {
greeting, err := ioutil.ReadFile(config.GetWebConfig().GreetingFile)
if err != nil {
return fmt.Errorf("Failed to load greeting: %v", err)
}
return RenderTemplate("root/index.html", w, map[string]interface{}{
"ctx": ctx,
"greeting": template.HTML(string(greeting)),
})
}