Skip to content

Commit

Permalink
Merge pull request #349 from saidone75/dev
Browse files Browse the repository at this point in the history
config docstrings
  • Loading branch information
saidone75 authored Jul 23, 2024
2 parents ab246da + 57d637a commit 523be7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/cral/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,20 @@
(def password "admin")

(defn configure
""
"Configures CRAL."
[& [m]]
;; configure alfresco
(swap! alfresco merge m)
(if-not (nil? (:user m)) (alter-var-root #'user (constantly (:user @alfresco))))
(if-not (nil? (:password m)) (alter-var-root #'password (constantly (:password @alfresco)))))

;; load global config map
(defn load-config
""
"Loads global config map."
[m]
(configure (:alfresco m)))

(defn get-url
""
"Builds Alfresco URL for the given `path`."
[path]
(let [path (keyword (str path "-path"))]
(format "%s://%s:%s/%s" (:scheme @alfresco) (:host @alfresco) (:port @alfresco) (path @alfresco))))
10 changes: 5 additions & 5 deletions src/cral/utils/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
(str/replace s #"^:+" ""))

(defn kebab-case
"Turn a camelCase string into kebab-case."
"Turns a camelCase string into kebab-case."
[s]
(->> s
(#(str/split % #"(?<=[a-z])(?=[A-Z])"))
(map #(str/lower-case %))
(str/join "-")))

(defn camel-case
"Turn a kebab-case string into camelCase."
"Turns a kebab-case string into camelCase."
[s]
(let [s (str/split s #"-")]
(if (> (count s) 1)
Expand Down Expand Up @@ -81,7 +81,7 @@
(walk/postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)))

(defn ok-response
"Build a successful response."
"Builds a successful response."
[r return-headers]
(let [response {:status (:status r)
:body (if (and (not (nil? (:body r))) (not (empty? (:body r))) (string? (:body r)))
Expand All @@ -92,7 +92,7 @@
response)))

(defn ex-response
"Build a response from a client exception."
"Builds a response from a client exception."
[^Exception e]
(t/trace! e)
(let [ex-data (ex-data e)]
Expand All @@ -107,7 +107,7 @@
:message (.getMessage e)}))))

(defn- add-auth
"Add authorization header from ticket."
"Adds authorization header from ticket."
[ticket req]
(if (nil? ticket)
req
Expand Down

0 comments on commit 523be7e

Please sign in to comment.