diff --git a/deps.edn b/deps.edn index be533605..3e24bdd4 100644 --- a/deps.edn +++ b/deps.edn @@ -1,8 +1,9 @@ {:deps {org.clojure/clojure {:mvn/version "1.11.3"} org.clojure/core.async {:mvn/version "1.6.681"} com.fluree/db {:git/url "https://github.com/fluree/db.git" - :git/sha "af564dbf2b3d90503a9f7de8143ffcfcd9767dd1"} - com.fluree/json-ld {:mvn/version "1.0.1"} + :git/sha "e6df029c3bf4f3117c3b0402aeea401fbed2d871"} + com.fluree/json-ld {:git/url "https://github.com/fluree/json-ld.git" + :git/sha "74083536c84d77f8cdd4b686b5661714010baad3"} integrant/integrant {:mvn/version "0.10.0"} com.fluree/crypto {:git/url "https://github.com/fluree/fluree.crypto.git" diff --git a/src/fluree/server/config.clj b/src/fluree/server/config.clj index 5ee7aa28..0aaee0fc 100644 --- a/src/fluree/server/config.clj +++ b/src/fluree/server/config.clj @@ -1,7 +1,7 @@ (ns fluree.server.config (:require [clojure.java.io :as io] [fluree.db.connection.config :as conn-config] - [fluree.db.util :as util :refer [get-id get-first-value]] + [fluree.db.util :as util :refer [get-id get-first-value of-type?]] [fluree.db.util.log :as log] [fluree.server.config.vocab :as vocab] [fluree.server.consensus :as-alias consensus] @@ -62,7 +62,7 @@ (defn consensus? [node] - (conn-config/type? node vocab/consensus-type)) + (of-type? node vocab/consensus-type)) (defn raft-consensus? [node] @@ -76,7 +76,7 @@ (defn http-api? [node] - (and (conn-config/type? node vocab/api-type) + (and (of-type? node vocab/api-type) (contains? node vocab/http-port))) (defn jetty-api? diff --git a/src/fluree/server/system.clj b/src/fluree/server/system.clj index fe467bf7..8505e672 100644 --- a/src/fluree/server/system.clj +++ b/src/fluree/server/system.clj @@ -4,7 +4,7 @@ [fluree.db.connection.config :as conn-config] [fluree.db.connection.system :as conn-system] [fluree.db.connection.vocab :as conn-vocab] - [fluree.db.util :as util :refer [get-first]] + [fluree.db.util :as util :refer [get-first of-type?]] [fluree.db.util.json :as json] [fluree.db.util.log :as log] [fluree.server :as-alias server] @@ -153,38 +153,38 @@ (defn log-config-summary [parsed-config] - (let [connection-config (some #(when (conn-config/type? % conn-vocab/connection-type) %) + (let [connection-config (some #(when (of-type? % conn-vocab/connection-type) %) (vals parsed-config)) - storage-config (some #(when (conn-config/type? % conn-vocab/storage-type) %) - (vals parsed-config)) - consensus-config (some #(when (config/consensus? %) %) - (vals parsed-config)) - http-config (some #(when (config/http-api? %) %) - (vals parsed-config)) - cache-mb (when connection-config - (conn-config/get-first-integer connection-config conn-vocab/cache-max-mb)) - storage-type (when storage-config - (let [storage-id (:id storage-config)] - (cond - (conn-config/get-first-string storage-config conn-vocab/file-path) - (str "File storage at " (conn-config/get-first-string storage-config conn-vocab/file-path)) - - (conn-config/get-first-string storage-config conn-vocab/s3-bucket) - (str "S3 storage (bucket: " (conn-config/get-first-string storage-config conn-vocab/s3-bucket) ")") - - (conn-config/get-first-string storage-config conn-vocab/ipfs-endpoint) - (str "IPFS storage (endpoint: " (conn-config/get-first-string storage-config conn-vocab/ipfs-endpoint) ")") - - :else - (str "Storage type: " (name (or storage-id "unknown")))))) - consensus-type (when consensus-config - (util/get-first-value consensus-config server-vocab/consensus-protocol)) + storage-config (some #(when (of-type? % conn-vocab/storage-type) %) + (vals parsed-config)) + consensus-config (some #(when (config/consensus? %) %) + (vals parsed-config)) + http-config (some #(when (config/http-api? %) %) + (vals parsed-config)) + cache-mb (when connection-config + (conn-config/get-first-integer connection-config conn-vocab/cache-max-mb)) + storage-type (when storage-config + (let [storage-id (:id storage-config)] + (cond + (conn-config/get-first-string storage-config conn-vocab/file-path) + (str "File storage at " (conn-config/get-first-string storage-config conn-vocab/file-path)) + + (conn-config/get-first-string storage-config conn-vocab/s3-bucket) + (str "S3 storage (bucket: " (conn-config/get-first-string storage-config conn-vocab/s3-bucket) ")") + + (conn-config/get-first-string storage-config conn-vocab/ipfs-endpoint) + (str "IPFS storage (endpoint: " (conn-config/get-first-string storage-config conn-vocab/ipfs-endpoint) ")") + + :else + (str "Storage type: " (name (or storage-id "unknown")))))) + consensus-type (when consensus-config + (util/get-first-value consensus-config server-vocab/consensus-protocol)) max-pending-txns (when (and consensus-config (= "standalone" consensus-type)) (conn-config/get-first-integer consensus-config server-vocab/max-pending-txns)) - http-port (when http-config - (conn-config/get-first-integer http-config server-vocab/http-port)) - closed-mode (when http-config - (conn-config/get-first-boolean http-config server-vocab/closed-mode))] + http-port (when http-config + (conn-config/get-first-integer http-config server-vocab/http-port)) + closed-mode (when http-config + (conn-config/get-first-boolean http-config server-vocab/closed-mode))] (log/info "Server configuration summary:") (log/info " HTTP port:" (or http-port "Not configured")) (log/info " Consensus mode:" (or consensus-type "Not configured")) diff --git a/test/fluree/server/integration/policy_test.clj b/test/fluree/server/integration/policy_test.clj index 30b68530..45e7cd53 100644 --- a/test/fluree/server/integration/policy_test.clj +++ b/test/fluree/server/integration/policy_test.clj @@ -296,7 +296,7 @@ (json/stringify (assoc secret-query "opts" {"policyClass" "ex:EmployeePolicy" - "policyValues" ["?$identity" [alice-did]]})) + "policyValues" ["?$identity" [{"@type" "@id" "@value" alice-did}]]})) :headers json-headers} query-res (api-post :query query-req)] @@ -316,7 +316,7 @@ schema:ssn ?ssn.}") :headers (assoc sparql-headers "Fluree-Policy-Class" "ex:EmployeePolicy" - "Fluree-Policy-Values" (json/stringify ["?$identity" [alice-did]]))} + "Fluree-Policy-Values" (json/stringify ["?$identity" [{"@type" "@id" "@value" alice-did}]]))} query-res (api-post :query query-req)] (is (= [["ex:alice" "111-11-1111"]] @@ -380,7 +380,7 @@ "f:action" {"@id" "f:view"} "f:query" {"@type" "@json" "@value" {}}}]} - policy-values ["?$identity" [alice-did]] + policy-values ["?$identity" [{"@type" "@id" "@value" alice-did}]] query-req {:body (json/stringify (assoc secret-query diff --git a/test/fluree/server/profile_test.clj b/test/fluree/server/profile_test.clj index a7c88485..2537fd6a 100644 --- a/test/fluree/server/profile_test.clj +++ b/test/fluree/server/profile_test.clj @@ -1,5 +1,6 @@ (ns fluree.server.profile-test (:require [clojure.test :refer [deftest is testing]] + [fluree.db.util :as util] [fluree.db.util.json :as json] [fluree.server :as server] [fluree.server.command :as command] @@ -81,27 +82,23 @@ (testing "Without profile, default values are used" (let [parsed-no-profile (config/parse json-config)] ;; Find the localStorage node - (is (some #(and (= :httpsnsflureeconfigtest/localStorage (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/localStorage (util/get-id %)) (= "/opt/fluree-server/data" - (-> (get % "https://ns.flur.ee/system#filePath") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#filePath"))) (vals parsed-no-profile))) ;; Find the connection node - (is (some #(and (= :httpsnsflureeconfigtest/connection (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/connection + (util/get-id %)) (= 1000 - (-> (get % "https://ns.flur.ee/system#cacheMaxMb") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#cacheMaxMb"))) (vals parsed-no-profile))) ;; Find the consensus node - (is (some #(and (= :httpsnsflureeconfigtest/consensus (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/consensus + (util/get-id %)) (= 512 - (-> (get % "https://ns.flur.ee/system#maxPendingTxns") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#maxPendingTxns"))) (vals parsed-no-profile))))) ;; Test with dev profile @@ -110,27 +107,24 @@ parsed-with-profile (config/parse config-with-profile)] ;; Find the localStorage node - should have dev/data - (is (some #(and (= :httpsnsflureeconfigtest/localStorage (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/localStorage + (util/get-id %)) (= "dev/data" - (-> (get % "https://ns.flur.ee/system#filePath") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#filePath"))) (vals parsed-with-profile))) ;; Find the connection node - cacheMaxMb should be 200 - (is (some #(and (= :httpsnsflureeconfigtest/connection (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/connection + (util/get-id %)) (= 200 - (-> (get % "https://ns.flur.ee/system#cacheMaxMb") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#cacheMaxMb"))) (vals parsed-with-profile))) ;; Find the consensus node - maxPendingTxns should be 16 - (is (some #(and (= :httpsnsflureeconfigtest/consensus (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/consensus + (util/get-id %)) (= 16 - (-> (get % "https://ns.flur.ee/system#maxPendingTxns") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#maxPendingTxns"))) (vals parsed-with-profile))))))) (deftest error-handling-test