use c4k-common
This commit is contained in:
parent
f542121386
commit
4f9e7e889d
8 changed files with 7 additions and 78 deletions
|
@ -15,7 +15,7 @@
|
||||||
"keycloak",
|
"keycloak",
|
||||||
"k8s",
|
"k8s",
|
||||||
"c4k",
|
"c4k",
|
||||||
"deplyoment",
|
"deployment",
|
||||||
"yaml",
|
"yaml",
|
||||||
"convention4kubernetes"
|
"convention4kubernetes"
|
||||||
],
|
],
|
||||||
|
|
|
@ -5,10 +5,7 @@
|
||||||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.10.3"]
|
:dependencies [[org.clojure/clojure "1.10.3"]
|
||||||
[org.clojure/tools.reader "1.3.4"]
|
[org.clojure/tools.reader "1.3.4"]
|
||||||
[aero "1.1.6"]
|
[org.domaindrivenarchitecture/c4k-common-clj "0.1.0-SNAPSHOT"]]
|
||||||
[orchestra "2021.01.01-1"]
|
|
||||||
[expound "0.8.9"]
|
|
||||||
[clj-commons/clj-yaml "0.7.106"]]
|
|
||||||
:target-path "target/%s/"
|
:target-path "target/%s/"
|
||||||
:source-paths ["src/main/cljc"
|
:source-paths ["src/main/cljc"
|
||||||
"src/main/clj"]
|
"src/main/clj"]
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
"src/main/resources"
|
"src/main/resources"
|
||||||
"src/test/cljc"
|
"src/test/cljc"
|
||||||
"src/test/resources"]
|
"src/test/resources"]
|
||||||
:dependencies [[aero "1.1.6"]
|
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "0.1.0-SNAPSHOT"]]
|
||||||
[orchestra "2021.01.01-1"]
|
|
||||||
[expound "0.8.9"]]
|
|
||||||
:dev-http {8080 "public"}
|
:dev-http {8080 "public"}
|
||||||
:builds {:frontend {:target :browser
|
:builds {:frontend {:target :browser
|
||||||
:modules {:main {:init-fn dda.c4k-keycloak.browser/init}}
|
:modules {:main {:init-fn dda.c4k-keycloak.browser/init}}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
(ns dda.c4k-keycloak.base64
|
|
||||||
(:import (java.util Base64)))
|
|
||||||
|
|
||||||
(defn encode
|
|
||||||
[string]
|
|
||||||
(.encodeToString
|
|
||||||
(Base64/getEncoder)
|
|
||||||
(.getBytes string "UTF-8")))
|
|
||||||
|
|
||||||
(defn decode
|
|
||||||
[string]
|
|
||||||
(String.
|
|
||||||
(.decode (Base64/getDecoder) string)
|
|
||||||
"UTF-8"))
|
|
|
@ -1,41 +0,0 @@
|
||||||
(ns dda.c4k-keycloak.common
|
|
||||||
(:require
|
|
||||||
[clojure.walk]))
|
|
||||||
|
|
||||||
(defn bash-env-string?
|
|
||||||
[input]
|
|
||||||
(and (string? input)
|
|
||||||
(not (re-matches #".*['\"\$]+.*" input))))
|
|
||||||
|
|
||||||
(defn fqdn-string?
|
|
||||||
[input]
|
|
||||||
(and (string? input)
|
|
||||||
(some? (re-matches #"(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)" input))))
|
|
||||||
|
|
||||||
(defn letsencrypt-issuer?
|
|
||||||
[input]
|
|
||||||
(contains? #{:prod :staging} input))
|
|
||||||
|
|
||||||
(defn replace-named-value
|
|
||||||
[coll name value]
|
|
||||||
(clojure.walk/postwalk #(if (and (map? %)
|
|
||||||
(= name (:name %)))
|
|
||||||
{:name name :value value}
|
|
||||||
%)
|
|
||||||
coll))
|
|
||||||
|
|
||||||
(defn replace-key-value
|
|
||||||
[coll key value]
|
|
||||||
(clojure.walk/postwalk #(if (and (map? %)
|
|
||||||
(contains? % key))
|
|
||||||
(assoc % key value)
|
|
||||||
%)
|
|
||||||
coll))
|
|
||||||
|
|
||||||
(defn replace-all-matching-values-by-new-value
|
|
||||||
[coll value-to-match value-to-replace]
|
|
||||||
(clojure.walk/postwalk #(if (and (= (type value-to-match) (type %))
|
|
||||||
(= value-to-match %))
|
|
||||||
value-to-replace
|
|
||||||
%)
|
|
||||||
coll))
|
|
|
@ -2,8 +2,8 @@
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[dda.c4k-keycloak.yaml :as yaml]
|
[dda.c4k-keycloak.yaml :as yaml]
|
||||||
[dda.c4k-keycloak.base64 :as b64]
|
[dda.c4k-common.base64 :as b64]
|
||||||
[dda.c4k-keycloak.common :as cm]))
|
[dda.c4k-common.common :as cm]))
|
||||||
|
|
||||||
(s/def ::keycloak-admin-user cm/bash-env-string?)
|
(s/def ::keycloak-admin-user cm/bash-env-string?)
|
||||||
(s/def ::keycloak-admin-password cm/bash-env-string?)
|
(s/def ::keycloak-admin-password cm/bash-env-string?)
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[dda.c4k-keycloak.yaml :as yaml]
|
[dda.c4k-keycloak.yaml :as yaml]
|
||||||
[dda.c4k-keycloak.base64 :as b64]
|
[dda.c4k-common.base64 :as b64]
|
||||||
[dda.c4k-keycloak.common :as cm]))
|
[dda.c4k-common.common :as cm]))
|
||||||
|
|
||||||
(s/def ::postgres-db-user cm/bash-env-string?)
|
(s/def ::postgres-db-user cm/bash-env-string?)
|
||||||
(s/def ::postgres-db-password cm/bash-env-string?)
|
(s/def ::postgres-db-password cm/bash-env-string?)
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
(ns dda.c4k-keycloak.base64
|
|
||||||
(:require
|
|
||||||
["js-base64" :as b64]))
|
|
||||||
|
|
||||||
(defn encode
|
|
||||||
[string]
|
|
||||||
(.encode b64/Base64 string))
|
|
||||||
|
|
||||||
(defn decode
|
|
||||||
[string]
|
|
||||||
(.decode b64/Base64 string))
|
|
Loading…
Reference in a new issue