Skip to content
Snippets Groups Projects
Commit 1f103973 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

make variable injection a function because it needs to be realized at runtime....

make variable injection a function because it needs to be realized at runtime.  also add the setup token to the bootstrap info.
parent 50713d71
Branches
Tags
No related merge requests found
......@@ -22,12 +22,13 @@
"Java SimpleDateFormat representing rfc2616 style date used in http headers."
"EEE, dd MMM yyyy HH:mm:ss zzz")
(def index-page-vars
(defn index-page-vars []
"Static values that we inject into the index.html page via Mustache."
{:ga_code "UA-60817802-1"
:intercom_code "gqfmsgf1"
{:ga_code "UA-60817802-1"
:intercom_code "gqfmsgf1"
:anon_tracking_enabled (metabase.models.setting/get :anon-tracking-enabled)
:site_name (metabase.models.setting/get :site-name)})
:site_name (metabase.models.setting/get :site-name)
:setup_token (setup/token-value)})
;; Redirect naughty users who try to visit a page other than setup if setup is not yet complete
(let [redirect-to-setup? (fn [{:keys [uri]}]
......@@ -37,7 +38,7 @@
(if (redirect-to-setup? request) (resp/redirect (format "/setup/init/%s" (setup/token-value)))
(-> (resp/response (stencil/render-string
(load-index)
{:bootstrap_json (cheshire/generate-string index-page-vars)}))
{:bootstrap_json (cheshire/generate-string (index-page-vars))}))
(resp/content-type "text/html")
(resp/header "Last-Modified" (u/now-with-format date-format-rfc2616)))))]
(defroutes routes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment