aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-05-28 23:28:32 +0100
committerNiall Sheridan <nsheridan@gmail.com>2016-05-28 23:28:32 +0100
commit69973a0c0cea573d444d46b5ae69bebc1567a9b8 (patch)
tree61fb2ac88ca974f0f9e7ea5e03dff251c5936872 /cmd
parentf1a898a1adb2d3a0facfece2729bd0c527781bdc (diff)
Define the token tmpl as a string
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cashierd/main.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/cashierd/main.go b/cmd/cashierd/main.go
index 61461a7..2a8d2b8 100644
--- a/cmd/cashierd/main.go
+++ b/cmd/cashierd/main.go
@@ -13,7 +13,6 @@ import (
"log"
"net/http"
"os"
- "path"
"strings"
"time"
@@ -27,6 +26,7 @@ import (
"github.com/nsheridan/cashier/server/auth/google"
"github.com/nsheridan/cashier/server/config"
"github.com/nsheridan/cashier/server/signer"
+ "github.com/nsheridan/cashier/templates"
)
var (
@@ -38,7 +38,6 @@ type appContext struct {
cookiestore *sessions.CookieStore
authprovider auth.Provider
authsession *auth.Session
- views *template.Template
sshKeySigner *signer.KeySigner
}
@@ -154,7 +153,9 @@ func rootHandler(a *appContext, w http.ResponseWriter, r *http.Request) (int, er
page := struct {
Token string
}{tok.AccessToken}
- a.views.ExecuteTemplate(w, "token.html", page)
+
+ tmpl := template.Must(template.New("token.html").Parse(templates.Token))
+ tmpl.Execute(w, page)
return http.StatusOK, nil
}
@@ -226,7 +227,6 @@ func main() {
ctx := &appContext{
cookiestore: sessions.NewCookieStore([]byte(config.Server.CookieSecret)),
authprovider: authprovider,
- views: template.Must(template.ParseGlob(path.Join(config.Server.TemplateDir, "*"))),
sshKeySigner: signer,
}
ctx.cookiestore.Options = &sessions.Options{