             [chat.server.cache :refer [cache-set! cache-get cache-del! random-nonce]]
             [chat.server.crypto :refer [hmac constant-comp]]
             [chat.server.db :as db]
+            [environ.core :refer [env]]
             [braid.server.conf :refer [config]]))
 
 (when (and (= (env :environment) "prod") (empty? (env :hmac-secret)))
   (println "WARNING: No :hmac-secret set, using an insecure default."))
 
-(def hmac-secret (config :hmac-secret))
-
 (defn verify-hmac
   [mac data]
   (constant-comp
     mac
-    (hmac hmac-secret data)))
+    (hmac (config :hmac-secret) data)))
 
 (defn verify-invite-nonce
   "Verify that the given nonce is valid for the invite"

(defn register-page
  [invite token]
  (let [now (.getTime (java.util.Date.))
        form-hmac (hmac hmac-secret
                        (str now token (invite :id) (invite :invitee-email)))
        api-domain (:api-domain config)]
    (clostache/render-resource "templates/register_page.html.mustache"

  [group-id]
  (let [now (.getTime (java.util.Date.))
        group (db/get-group group-id)
        form-hmac (hmac (config :hmac-secret) (str now group-id))
        api-domain (:api-domain config)]
    (clostache/render-resource "templates/link_signup.html.mustache"
                               {:api-domain api-domain
