Remove backend-uri from all the codebase.

This commit is contained in:
Andrey Antukh 2020-06-03 10:50:05 +02:00
parent e1ae3da41e
commit 9901f0a52b
11 changed files with 27 additions and 33 deletions

View file

@ -99,7 +99,6 @@ function readLocales() {
function readConfig(data) {
const googleClientID = process.env.UXBOX_GOOGLE_CLIENT_ID;
const publicURI = process.env.UXBOX_PUBLIC_URI;
const backendURI = process.env.UXBOX_BACKEND_URI;
const demoWarn = process.env.UXBOX_DEMO_WARNING;
const deployDate = process.env.UXBOX_DEPLOY_DATE;
const deployCommit = process.env.UXBOX_DEPLOY_COMMIT;
@ -116,10 +115,6 @@ function readConfig(data) {
cfg.publicURI = publicURI;
}
if (backendURI !== undefined) {
cfg.backendURI = backendURI;
}
if (deployDate !== undefined) {
cfg.deployDate = deployDate;
}

View file

@ -12,13 +12,11 @@
(this-as global
(let [config (obj/get global "uxboxConfig")
puri (obj/get config "publicURI" "http://localhost:3449")
buri (obj/get config "backendURI" "http://localhost:3449")
puri (obj/get config "publicURI" "http://localhost:3449/")
gcid (obj/get config "googleClientID" true)
warn (obj/get config "demoWarning" true)]
(def default-language "en")
(def demo-warning warn)
(def backend-uri buri)
(def google-client-id gcid)
(def public-uri puri)
(def default-theme "default")))

View file

@ -29,13 +29,13 @@
(defn send-query!
[id params]
(let [uri (str cfg/backend-uri "/api/w/query/" (name id))]
(let [uri (str cfg/public-uri "/api/w/query/" (name id))]
(->> (http/send! {:method :get :uri uri :query params})
(rx/mapcat handle-response))))
(defn send-mutation!
[id params]
(let [uri (str cfg/backend-uri "/api/w/mutation/" (name id))]
(let [uri (str cfg/public-uri "/api/w/mutation/" (name id))]
(->> (http/send! {:method :post :uri uri :body params})
(rx/mapcat handle-response))))
@ -64,7 +64,7 @@
(defmethod mutation :login-with-google
[id params]
(let [uri (str cfg/backend-uri "/api/oauth/google")]
(let [uri (str cfg/public-uri "/api/oauth/google")]
(->> (http/send! {:method :post :uri uri})
(rx/mapcat handle-response))))
@ -94,13 +94,13 @@
(defmethod mutation :login
[id params]
(let [uri (str cfg/backend-uri "/api/login")]
(let [uri (str cfg/public-uri "/api/login")]
(->> (http/send! {:method :post :uri uri :body params})
(rx/mapcat handle-response))))
(defmethod mutation :logout
[id params]
(let [uri (str cfg/backend-uri "/api/logout")]
(let [uri (str cfg/public-uri "/api/logout")]
(->> (http/send! {:method :post :uri uri :body params})
(rx/mapcat handle-response))))

View file

@ -23,8 +23,8 @@
(defonce instance
(when (not= *target* "nodejs")
(let [uri (Uri. cfg/public-uri)]
(.setPath uri "js/worker.js")
(.setParameterValue uri "backendURI" cfg/backend-uri)
(.setPath uri "/js/worker.js")
(.setParameterValue uri "publicURI" cfg/public-uri)
(uw/init (.toString uri) on-error))))
(defn ask!

View file

@ -27,7 +27,7 @@
(defn uri
([path] (uri path {}))
([path params]
(let [uri (.parse Uri cfg/backend-uri)]
(let [uri (.parse Uri cfg/public-uri)]
(.setPath uri path)
(if (= (.getScheme uri) "http")
(.setScheme uri "ws")

View file

@ -30,8 +30,8 @@
(this-as global
(let [location (obj/get global "location")
uri (Uri. (obj/get location "href"))
buri (.getParameterValue uri "backendURI")]
(swap! impl/config assoc :backend-uri buri)))
puri (.getParameterValue uri "publicURI")]
(swap! impl/config assoc :public-uri puri)))
;; --- Messages Handling

View file

@ -33,7 +33,7 @@
(defn- request-page
[id]
(let [uri (get @impl/config :backend-uri "http://localhost:6060")
(let [uri (get @impl/config :public-uri "http://localhost:3449/")
uri (str uri "/api/w/query/page")]
(p/create
(fn [resolve reject]