Skip to content
Snippets Groups Projects
Commit de04d5d6 authored by Cam Saül's avatar Cam Saül
Browse files

fix broken events initialization.

Remove some unneeded imports
parent 0af435c1
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
(:require [clojure.java.jdbc :as jdbc]
[clojure.tools.logging :as log]
(clojure [set :as set]
[string :as str])
[string :as s])
[environ.core :refer [env]]
(korma [core :as k]
[db :as kdb])
......@@ -53,8 +53,8 @@
"Connection details for Korma / JDBC."
(delay (let [details @db-connection-details]
(case (config/config-kw :mb-db-type)
:h2 (kdb/h2 (assoc details :naming {:keys str/lower-case
:fields str/upper-case}))
:h2 (kdb/h2 (assoc details :naming {:keys s/lower-case
:fields s/upper-case}))
:postgres (kdb/postgres (assoc details :db (:dbname details)))))))
......
......@@ -2,7 +2,7 @@
(:require clojure.java.classpath
[clojure.tools.logging :as log]
[medley.core :as m]
[metabase.db :refer [exists? ins sel upd]]
[metabase.db :refer [ins sel upd]]
(metabase.driver [interface :as i]
[query-processor :as qp])
(metabase.models [database :refer [Database]]
......
......@@ -21,18 +21,17 @@
(atom nil))
(defn- find-and-load-event-handlers
"Search Classpath for namespaces that start with `metabase.events.`, then `require` them so initialization can happen."
"Search Classpath for namespaces that start with `metabase.events.`, and call their `events-init` function if it exists."
[]
(->> (ns-find/find-namespaces (clojure.java.classpath/classpath))
(filter (fn [ns-symb]
(re-find #"^metabase\.events\." (name ns-symb))))
set
(map (fn [events-ns]
(log/info "\tloading events namespace: " events-ns)
(require events-ns)
;; look for `events-init` function in the namespace and call it if it exists
((ns-resolve events-ns 'events-init))))
dorun))
(doseq [events-ns (->> (ns-find/find-namespaces (clojure.java.classpath/classpath))
(map name)
(filter (partial re-find #"^metabase\.events\."))
(map symbol))]
(log/info "\tloading events namespace: " events-ns)
(require events-ns)
;; look for `events-init` function in the namespace and call it if it exists
(when-let [events-init (ns-resolve events-ns 'events-init)]
(events-init))))
(defn initialize-events!
"Initialize the asynchronous internal events system."
......
(ns metabase.models.common
(:require [clojure.string :as s]
[metabase.api.common :refer [*current-user* *current-user-id* check]]
[metabase.util :as u]))
(:require [clojure.string :as s]))
(def ^:const timezones
["GMT"
......
(ns metabase.models.setting
(:refer-clojure :exclude [get set])
(:require [clojure.core.match :refer [match]]
[clojure.string :as s]
(:require [clojure.string :as s]
[environ.core :as env]
[korma.core :as k]
[metabase.config :as config]
......@@ -9,7 +8,8 @@
[metabase.models [common :as common]
[interface :refer :all]]
[metabase.setup :as setup]
[metabase.util :as u]))
[metabase.util :as u]
[metabase.util.password :as password]))
;; Settings are a fast + simple way to create a setting that can be set
;; from the SuperAdmin page. They are saved to the Database, but intelligently
......@@ -153,18 +153,18 @@
(sort-by :key))))
(defn public-settings
"Return a simple map of key/value pairs which represent the public settings for the application."
"Return a simple map of key/value pairs which represent the public settings for the front-end application."
[]
{:ga_code "UA-60817802-1"
:intercom_code "gqfmsgf1"
:password_complexity (metabase.util.password/active-password-complexity)
:password_complexity (password/active-password-complexity)
:setup_token (setup/token-value)
:timezones common/timezones
:version (config/mb-version-info)
;; all of these values are dynamic settings controlled at runtime
:anon_tracking_enabled (= "true" (get :anon-tracking-enabled))
:site_name (get :site-name)
:email_configured (not (clojure.string/blank? (get :email-smtp-host)))})
:email_configured (not (s/blank? (get :email-smtp-host)))})
;; # IMPLEMENTATION
......
......@@ -6,22 +6,15 @@
[ring.util.response :as resp]
[stencil.core :as stencil]
[metabase.api.routes :as api]
(metabase.models common
[setting :as setting])
[metabase.util :as u]
metabase.util.password))
[metabase.models.setting :as setting]))
(def ^:private ^:const date-format-rfc2616
"Java SimpleDateFormat representing rfc2616 style date used in http headers."
"EEE, dd MMM yyyy HH:mm:ss zzz")
(defn- index [request]
(defn- index [_]
(-> (io/resource "frontend_client/index.html")
slurp
(stencil/render-string {:bootstrap_json (json/generate-string (setting/public-settings))})
resp/response
(resp/content-type "text/html")
(resp/header "Last-Modified" (u/now-with-format date-format-rfc2616))))
(resp/header "Last-Modified" "{now} GMT")))
;; Redirect naughty users who try to visit a page other than setup if setup is not yet complete
(defroutes routes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment