diff --git a/backend/scripts/_env b/backend/scripts/_env index 56fd3885ab..ffba47a128 100644 --- a/backend/scripts/_env +++ b/backend/scripts/_env @@ -56,6 +56,8 @@ export PENPOT_OBJECTS_STORAGE_BACKEND=s3 export PENPOT_OBJECTS_STORAGE_S3_ENDPOINT=http://minio:9000 export PENPOT_OBJECTS_STORAGE_S3_BUCKET=penpot +export PENPOT_NITRATE_BACKEND_URI=http://localhost:3000 + export JAVA_OPTS="\ -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager \ -Djdk.attach.allowAttachSelf \ diff --git a/backend/src/app/config.clj b/backend/src/app/config.clj index de030f2e11..7ba69d7710 100644 --- a/backend/src/app/config.clj +++ b/backend/src/app/config.clj @@ -225,6 +225,8 @@ [:netty-io-threads {:optional true} ::sm/int] [:executor-threads {:optional true} ::sm/int] + [:nitrate-backend-uri {:optional true} ::sm/uri] + ;; DEPRECATED [:assets-storage-backend {:optional true} :keyword] [:storage-assets-fs-directory {:optional true} :string] diff --git a/backend/src/app/nitrate.clj b/backend/src/app/nitrate.clj index 2ff2472870..4a894e554f 100644 --- a/backend/src/app/nitrate.clj +++ b/backend/src/app/nitrate.clj @@ -18,8 +18,7 @@ [integrant.core :as ig])) -;; TODO Extract to env -(def baseuri "http://localhost:3000") +(def baseuri (cf/get :nitrate-backend-uri)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/backend/src/app/rpc/management/nitrate.clj b/backend/src/app/rpc/management/nitrate.clj index 072701e918..2bd68387d6 100644 --- a/backend/src/app/rpc/management/nitrate.clj +++ b/backend/src/app/rpc/management/nitrate.clj @@ -25,10 +25,6 @@ [cuerdas.core :as str])) ;; ---- API: authenticate -(def ^:private schema:authenticate-params - [:map - [:token :string]]) - (def ^:private schema:profile [:map [:id ::sm/uuid] @@ -37,20 +33,14 @@ [:photo-url :string]]) (sv/defmethod ::authenticate - "Authenticate an user by token + "Authenticate an user @api GET /authenticate @returns 200 OK: Returns the authenticated user." {::doc/added "2.12" - ::sm/params schema:authenticate-params ::sm/result schema:profile} - [cfg {:keys [token] :as params}] - (let [_ (prn params) - token (str/replace-first token #"^auth-token=" "") - claims (tokens/verify cfg {:token token :iss "authentication"}) - profile-id (:uid claims) - profile (profile/get-profile cfg profile-id)] - ;; TODO Manage bad token + [cfg {:keys [::rpc/profile-id] :as params}] + (let [profile (profile/get-profile cfg profile-id)] {:id (get profile :id) :name (get profile :fullname) :email (get profile :email) @@ -102,11 +92,11 @@ @returns 200 OK" {::doc/added "2.12" - ::sm/params schema:notify-team-change} + ::sm/params schema:notify-team-change + ::rpc/auth false} [cfg {:keys [id organization-id organization-name]}] (when (contains? cf/flags :nitrate) (let [msgbus (::mbus/msgbus cfg)] - (prn "Team" id "has changed to org" organization-name "(" organization-id ")") (mbus/pub! msgbus ;;TODO There is a bug on dashboard with teams notifications. ;;For now we send it to uuid/zero instead of team-id