refactore auth -> websiteauths
This commit is contained in:
parent
20401c20b7
commit
1b1d316653
5 changed files with 13 additions and 13 deletions
|
@ -40,14 +40,14 @@
|
||||||
::build-memory-limit]))
|
::build-memory-limit]))
|
||||||
(def websiteauth? (s/keys :req-un [::unique-name ::username ::authtoken]))
|
(def websiteauth? (s/keys :req-un [::unique-name ::username ::authtoken]))
|
||||||
(s/def ::websiteconfigs (s/coll-of websiteconfig?))
|
(s/def ::websiteconfigs (s/coll-of websiteconfig?))
|
||||||
(s/def ::auth (s/coll-of websiteauth?))
|
(s/def ::websiteauths (s/coll-of websiteauth?))
|
||||||
|
|
||||||
(def config? (s/keys :req-un [::websiteconfigs]
|
(def config? (s/keys :req-un [::websiteconfigs]
|
||||||
:opt-un [::issuer
|
:opt-un [::issuer
|
||||||
::volume-size
|
::volume-size
|
||||||
::mon-cfg]))
|
::mon-cfg]))
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::auth]
|
(def auth? (s/keys :req-un [::websiteauths]
|
||||||
:opt-un [::mon-auth]))
|
:opt-un [::mon-auth]))
|
||||||
|
|
||||||
(def config-defaults {:issuer "staging"})
|
(def config-defaults {:issuer "staging"})
|
||||||
|
@ -68,9 +68,9 @@
|
||||||
|
|
||||||
(defn-spec sort-auth map?
|
(defn-spec sort-auth map?
|
||||||
[unsorted-auth auth?]
|
[unsorted-auth auth?]
|
||||||
(let [sorted-auth (into [] (sort-by :unique-name (unsorted-auth :auth)))]
|
(let [sorted-auth (into [] (sort-by :unique-name (unsorted-auth :websiteauths)))]
|
||||||
(-> unsorted-auth
|
(-> unsorted-auth
|
||||||
(assoc-in [:auth] sorted-auth))))
|
(assoc-in [:websiteauths] sorted-auth))))
|
||||||
|
|
||||||
(defn-spec flatten-and-reduce-config map?
|
(defn-spec flatten-and-reduce-config map?
|
||||||
[config config?]
|
[config config?]
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
(defn-spec flatten-and-reduce-auth map?
|
(defn-spec flatten-and-reduce-auth map?
|
||||||
[auth auth?]
|
[auth auth?]
|
||||||
(-> auth :auth first))
|
(-> auth :websiteauths first))
|
||||||
|
|
||||||
(defn-spec generate-ingress seq?
|
(defn-spec generate-ingress seq?
|
||||||
[config websiteconfig?]
|
[config websiteconfig?]
|
||||||
|
@ -103,14 +103,14 @@
|
||||||
sorted-auth (sort-auth auth)
|
sorted-auth (sort-auth auth)
|
||||||
result []]
|
result []]
|
||||||
|
|
||||||
(if (and (empty? (config :websiteconfigs)) (empty? (sorted-auth :auth)))
|
(if (and (empty? (config :websiteconfigs)) (empty? (sorted-auth :websiteauths)))
|
||||||
result
|
result
|
||||||
(recur (->
|
(recur (->
|
||||||
config
|
config
|
||||||
(assoc-in [:websiteconfigs] (rest (config :websiteconfigs))))
|
(assoc-in [:websiteconfigs] (rest (config :websiteconfigs))))
|
||||||
(->
|
(->
|
||||||
auth
|
auth
|
||||||
(assoc-in [:auth] (rest (sorted-auth :auth))))
|
(assoc-in [:websiteauths] (rest (sorted-auth :websiteauths))))
|
||||||
(let [final-config
|
(let [final-config
|
||||||
(merge
|
(merge
|
||||||
website-config-defaults
|
website-config-defaults
|
||||||
|
|
|
@ -48,11 +48,11 @@
|
||||||
|
|
||||||
(s/def ::websiteconfigs (s/coll-of websiteconfig?))
|
(s/def ::websiteconfigs (s/coll-of websiteconfig?))
|
||||||
|
|
||||||
(s/def ::auth (s/coll-of websiteauth?))
|
(s/def ::websiteauths (s/coll-of websiteauth?))
|
||||||
|
|
||||||
(def websiteconfigs? (s/keys :req-un [::websiteconfigs]))
|
(def websiteconfigs? (s/keys :req-un [::websiteconfigs]))
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::auth]))
|
(def auth? (s/keys :req-un [::websiteauths]))
|
||||||
|
|
||||||
(defn-spec replace-dots-by-minus string?
|
(defn-spec replace-dots-by-minus string?
|
||||||
[fqdn pred/fqdn-string?]
|
[fqdn pred/fqdn-string?]
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
"{:mon-auth
|
"{:mon-auth
|
||||||
{:grafana-cloud-user \"your-user-id\"
|
{:grafana-cloud-user \"your-user-id\"
|
||||||
:grafana-cloud-password \"your-cloud-password\"}
|
:grafana-cloud-password \"your-cloud-password\"}
|
||||||
:auth
|
:websiteauths
|
||||||
[{:unique-name \"test.io\",
|
[{:unique-name \"test.io\",
|
||||||
:username \"someuser\",
|
:username \"someuser\",
|
||||||
:authtoken \"abedjgbasdodj\"}
|
:authtoken \"abedjgbasdodj\"}
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
:branchname "main"}]})
|
:branchname "main"}]})
|
||||||
|
|
||||||
(def auth1
|
(def auth1
|
||||||
{:auth
|
{:websiteauths
|
||||||
[{:unique-name "example.io"
|
[{:unique-name "example.io"
|
||||||
:username "someuser"
|
:username "someuser"
|
||||||
:authtoken "abedjgbasdodj"}
|
:authtoken "abedjgbasdodj"}
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
:authtoken "abedjgbasdodj"}]})
|
:authtoken "abedjgbasdodj"}]})
|
||||||
|
|
||||||
(def auth2
|
(def auth2
|
||||||
{:auth
|
{:websiteauths
|
||||||
[{:unique-name "test.io"
|
[{:unique-name "test.io"
|
||||||
:username "someuser"
|
:username "someuser"
|
||||||
:authtoken "abedjgbasdodj"}
|
:authtoken "abedjgbasdodj"}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
auth:
|
websiteauths:
|
||||||
- unique-name: "test.io"
|
- unique-name: "test.io"
|
||||||
username: "someuser"
|
username: "someuser"
|
||||||
authtoken: "abedjgbasdodj"
|
authtoken: "abedjgbasdodj"
|
||||||
|
|
Loading…
Reference in a new issue