added specs for generate-secrets
This commit is contained in:
parent
ce1a19eb0e
commit
edfa762a39
2 changed files with 8 additions and 6 deletions
|
@ -26,6 +26,6 @@
|
||||||
:postgres-size :2gb})
|
:postgres-size :2gb})
|
||||||
(postgres/generate-service)
|
(postgres/generate-service)
|
||||||
(gitea/generate-appini-env config)
|
(gitea/generate-appini-env config)
|
||||||
(gitea/generate-secrets config)
|
(gitea/generate-secrets (:auth config))
|
||||||
(gitea/generate-ingress config)
|
(gitea/generate-ingress config)
|
||||||
(gitea/generate-certificate config)]))))
|
(gitea/generate-certificate config)]))))
|
||||||
|
|
|
@ -12,13 +12,15 @@
|
||||||
|
|
||||||
(s/def ::fqdn pred/fqdn-string?)
|
(s/def ::fqdn pred/fqdn-string?)
|
||||||
(s/def ::issuer pred/letsencrypt-issuer?)
|
(s/def ::issuer pred/letsencrypt-issuer?)
|
||||||
|
(s/def ::maileruser pred/bash-env-string?)
|
||||||
|
(s/def ::mailerpw pred/bash-env-string?)
|
||||||
|
|
||||||
(def config-defaults {:issuer "staging"})
|
(def config-defaults {:issuer "staging"})
|
||||||
|
|
||||||
(def config? (s/keys :req-un [::fqdn]
|
(def config? (s/keys :req-un [::fqdn]
|
||||||
:opt-un [::issuer]))
|
:opt-un [::issuer]))
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password]))
|
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password ::maileruser ::mailerpw]))
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defmethod yaml/load-resource :gitea [resource-name]
|
(defmethod yaml/load-resource :gitea [resource-name]
|
||||||
|
@ -50,12 +52,12 @@
|
||||||
(cm/replace-all-matching-values-by-new-value "DBPW" postgres-db-password))))
|
(cm/replace-all-matching-values-by-new-value "DBPW" postgres-db-password))))
|
||||||
|
|
||||||
(defn-spec generate-secrets pred/map-or-seq?
|
(defn-spec generate-secrets pred/map-or-seq?
|
||||||
[config config?]
|
[auth auth?]
|
||||||
(let [{:keys [mailer-user mailer-pw]} config]
|
(let [{:keys [maileruser mailerpw]} auth]
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "gitea/secrets.yaml")
|
(yaml/load-as-edn "gitea/secrets.yaml")
|
||||||
(cm/replace-all-matching-values-by-new-value "MAILERUSER" (b64/encode mailer-user))
|
(cm/replace-all-matching-values-by-new-value "MAILERUSER" (b64/encode maileruser))
|
||||||
(cm/replace-all-matching-values-by-new-value "MAILERPW" (b64/encode mailer-pw))
|
(cm/replace-all-matching-values-by-new-value "MAILERPW" (b64/encode mailerpw))
|
||||||
)))
|
)))
|
||||||
|
|
||||||
(defn-spec generate-ingress pred/map-or-seq?
|
(defn-spec generate-ingress pred/map-or-seq?
|
||||||
|
|
Loading…
Reference in a new issue