Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: milo/appengine/common/middleware.go

Issue 2918563004: Milo: Fix deployment (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « milo/appengine/buildbot/html_test.go ('k') | milo/appengine/frontend/main.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/common/middleware.go
diff --git a/milo/appengine/common/middleware.go b/milo/appengine/common/middleware.go
index 0a6482cbc8c0094875d973d7cad82523f5b8a08e..c54d2b3ac71608cab9a9477bbc06907cae762afd 100644
--- a/milo/appengine/common/middleware.go
+++ b/milo/appengine/common/middleware.go
@@ -27,10 +27,11 @@ import (
var authconfig *auth.Config
// GetTemplateBundles is used to render HTML templates. It provides base args
-// passed to all templates.
-func GetTemplateBundle() *templates.Bundle {
+// passed to all templates. It takes a path to the template folder, relative
+// to the path of the binary during runtime.
+func GetTemplateBundle(templatePath string) *templates.Bundle {
return &templates.Bundle{
- Loader: templates.FileSystemLoader("../frontend/templates"),
+ Loader: templates.FileSystemLoader(templatePath),
DebugMode: info.IsDevAppServer,
DefaultTemplate: "base",
DefaultArgs: func(c context.Context) (templates.Args, error) {
@@ -61,11 +62,11 @@ func GetTemplateBundle() *templates.Bundle {
}
// Base returns the basic LUCI appengine middlewares.
-func Base() router.MiddlewareChain {
+func Base(templatePath string) router.MiddlewareChain {
return gaemiddleware.BaseProd().Extend(
auth.Authenticate(server.CookieAuth),
withRequestMiddleware,
- templates.WithTemplates(GetTemplateBundle()),
+ templates.WithTemplates(GetTemplateBundle(templatePath)),
)
}
« no previous file with comments | « milo/appengine/buildbot/html_test.go ('k') | milo/appengine/frontend/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698