0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 07:50:43 -05:00

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

@ -5,18 +5,18 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2017-2020 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.config
"A configuration management."
(:require
[clojure.tools.logging :as log]
[clojure.spec.alpha :as s]
[uxbox.common.spec :as us]
[clojure.tools.logging :as log]
[cuerdas.core :as str]
[environ.core :refer [env]]
[mount.core :refer [defstate]]
[uxbox.common.exceptions :as ex]
[uxbox.common.spec :as us]
[uxbox.util.time :as tm]))
(def defaults
@ -26,14 +26,13 @@
:database-username "uxbox"
:database-password "uxbox"
:public-uri "http://localhost:3449"
:backend-uri "http://localhost:6060"
:redis-uri "redis://redis/0"
:media-directory "resources/public/media"
:assets-directory "resources/public/static"
:media-uri "http://localhost:6060/media"
:assets-uri "http://localhost:6060/static"
:public-uri "http://localhost:3449/"
:redis-uri "redis://redis/0"
:media-uri "http://localhost:3449/media/"
:assets-uri "http://localhost:3449/static/"
:sendmail-backend "console"
:sendmail-reply-to "no-reply@example.com"

View file

@ -2,7 +2,10 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.http.auth.google
(:require
@ -27,7 +30,7 @@
(defn- build-redirect-url
[]
(let [public (uri/uri (:backend-uri cfg/config))]
(let [public (uri/uri (:public-uri cfg/config))]
(str (assoc public :path "/api/oauth/google/callback"))))
(defn- get-access-token

View file

@ -85,11 +85,11 @@ http {
}
location /media {
alias /var/www/app/media;
alias /home/uxbox/uxbox/backend/resources/public/media;
}
location /static {
alias /var/www/app/backend/resources/public/static;
alias /home/uxbox/uxbox/backend/resources/public/static;
}
}
}

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]

View file

@ -56,7 +56,6 @@ function build-frontend {
--mount source=${HOME}/.m2,type=bind,target=/home/uxbox/.m2 \
-w /home/uxbox/uxbox/frontend \
-e UXBOX_PUBLIC_URI=${UXBOX_PUBLIC_URI} \
-e UXBOX_BACKEND_URI=${UXBOX_BACKEND_URI} \
-e UXBOX_GOOGLE_CLIENT_ID=${UXBOX_GOOGLE_CLIENT_ID} \
-e UXBOX_DEMO_WARNING=${UXBOX_DEMO_WARNING} \
-e UXBOX_DEPLOY_DATE=${UXBOX_DEPLOY_DATE} \