Improve dynamic configuration handling.

This commit is contained in:
Andrey Antukh 2020-08-18 17:16:23 +02:00
parent fb910a24e1
commit 1118a995e2
4 changed files with 27 additions and 27 deletions

View file

@ -11,17 +11,15 @@
(:require [uxbox.util.object :as obj]))
(this-as global
(let [config (obj/get global "uxboxConfig" {})
wuri (obj/get global "uxboxWorkerURI" "/js/worker.js")]
(def default-language "en")
(def demo-warning (obj/get config "demoWarning" false))
(def google-client-id (obj/get config "googleClientID"))
(def login-with-ldap (obj/get config "loginWithLDAP" false))
(def worker-uri wuri)
(def public-uri (or (obj/get config "publicURI")
(.-origin ^js js/location)))
(def media-uri (str public-uri "/media"))
(def default-theme "default")))
(def default-language "en")
(def demo-warning (obj/get global "appDemoWarning" false))
(def google-client-id (obj/get global "appGoogleClientID" nil))
(def login-with-ldap (obj/get global "appLoginWithLDAP" false))
(def worker-uri (obj/get global "appWorkerURI" "/js/worker.js"))
(def public-uri (or (obj/get global "appPublicURI")
(.-origin ^js js/location)))
(def media-uri (str public-uri "/media"))
(def default-theme "default"))
(defn resolve-media-path
[path]

View file

@ -12,7 +12,6 @@
[hashp.core :include-macros true]
[cljs.spec.alpha :as s]
[beicon.core :as rx]
[goog.object :as gobj]
[rumext.alpha :as mf]
[uxbox.common.uuid :as uuid]
[uxbox.main.data.auth :refer [logout]]
@ -64,8 +63,8 @@
(defn ^:export init
[]
(let [translations (obj/get js/window "uxboxTranslations")
themes (gobj/get js/window "uxboxThemes")]
(let [translations (obj/get js/window "appTranslations")
themes (obj/get js/window "appThemes")]
(i18n/init! translations)
(theme/init! themes)
(st/init)