Luccas Code
This commit is contained in:
parent
ff38e1ca2d
commit
558653d698
2 changed files with 36 additions and 14 deletions
|
@ -26,10 +26,31 @@
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::user-name ::user-password]))
|
(def auth? (s/keys :req-un [::user-name ::user-password]))
|
||||||
|
|
||||||
|
(declare assoc-in-nested)
|
||||||
|
(declare assoc-in-nested-seq)
|
||||||
|
(declare assoc-in-nested-map)
|
||||||
|
|
||||||
(defn replace-values-in-map
|
(defn assoc-in-nested-seq [s path n]
|
||||||
[map keys value]
|
(map #(if (sequential? %)
|
||||||
)
|
(assoc-in-nested-seq % path n)
|
||||||
|
(assoc-in-nested-map % path n)) s))
|
||||||
|
|
||||||
|
(defn assoc-in-nested-map [m path n]
|
||||||
|
(into (empty m)
|
||||||
|
(let [p1 (first path)]
|
||||||
|
(for [[k v] m]
|
||||||
|
(if (= k p1)
|
||||||
|
[k (assoc-in-nested v (rest path) n)]
|
||||||
|
[k (assoc-in-nested v path n)])))))
|
||||||
|
|
||||||
|
(defn assoc-in-nested [data path n]
|
||||||
|
(if (empty? path)
|
||||||
|
n
|
||||||
|
(if (sequential? data)
|
||||||
|
(assoc-in-nested-seq data path n)
|
||||||
|
(if (map? data)
|
||||||
|
(assoc-in-nested-map data path n)
|
||||||
|
data))))
|
||||||
|
|
||||||
(defn generate-config [my-config my-auth]
|
(defn generate-config [my-config my-auth]
|
||||||
(->
|
(->
|
||||||
|
|
|
@ -93,8 +93,9 @@
|
||||||
:servicePort 8080}}]}}
|
:servicePort 8080}}]}}
|
||||||
{:host fqdn
|
{:host fqdn
|
||||||
:http {:paths [{:backend {:serviceName "another_keycloak"
|
:http {:paths [{:backend {:serviceName "another_keycloak"
|
||||||
:servicePort 8081}}]}}]))]
|
:servicePort 8081}}]}}
|
||||||
(is (= desired-result (cut/replace-values-in-map ingress-yaml [:spec :rules :host] fqdn))))
|
]))]
|
||||||
|
(is (= desired-result (cut/assoc-in-nested ingress-yaml [:spec :rules :host] fqdn))))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue