Fix test
This commit is contained in:
parent
e049a3fdda
commit
64a168e6b0
2 changed files with 11 additions and 10 deletions
|
@ -24,7 +24,7 @@
|
||||||
(> 0 snd)
|
(> 0 snd)
|
||||||
(<= 65535 snd))))))
|
(<= 65535 snd))))))
|
||||||
;TODO: Maybe move to pred/comma-separated-fqdn-list?
|
;TODO: Maybe move to pred/comma-separated-fqdn-list?
|
||||||
(s/def ::mailer-domain-whitelist #(every? true? (map pred/fqdn-string? (str/split % #","))))
|
(s/def ::service-domain-whitelist #(every? true? (map pred/fqdn-string? (str/split % #","))))
|
||||||
(s/def ::service-noreply-address pred/fqdn-string?)
|
(s/def ::service-noreply-address pred/fqdn-string?)
|
||||||
(s/def ::mailer-user pred/bash-env-string?)
|
(s/def ::mailer-user pred/bash-env-string?)
|
||||||
(s/def ::mailer-pw pred/bash-env-string?)
|
(s/def ::mailer-pw pred/bash-env-string?)
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
(def config-defaults {:issuer "staging"})
|
(def config-defaults {:issuer "staging"})
|
||||||
|
|
||||||
(def config? (s/keys :req-un [::fqdn ::mailer-from ::mailer-host-port ::service-noreply-address]
|
(def config? (s/keys :req-un [::fqdn ::mailer-from ::mailer-host-port ::service-noreply-address]
|
||||||
:opt-un [::issuer ::default-app-name ::mailer-domain-whitelist]))
|
:opt-un [::issuer ::default-app-name ::service-domain-whitelist]))
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password ::mailer-user ::mailer-pw]))
|
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password ::mailer-user ::mailer-pw]))
|
||||||
|
|
||||||
|
@ -62,10 +62,10 @@
|
||||||
fqdn
|
fqdn
|
||||||
mailer-from
|
mailer-from
|
||||||
mailer-host-port
|
mailer-host-port
|
||||||
mailer-domain-whitelist
|
service-domain-whitelist
|
||||||
service-noreply-address]
|
service-noreply-address]
|
||||||
:or {default-app-name "Gitea instance"
|
:or {default-app-name "Gitea instance"
|
||||||
mailer-domain-whitelist fqdn}}
|
service-domain-whitelist fqdn}}
|
||||||
config]
|
config]
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "gitea/appini-env-configmap.yaml")
|
(yaml/load-as-edn "gitea/appini-env-configmap.yaml")
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
(cm/replace-all-matching-values-by-new-value "URL" (str "https://" fqdn))
|
(cm/replace-all-matching-values-by-new-value "URL" (str "https://" fqdn))
|
||||||
(cm/replace-all-matching-values-by-new-value "FROM" mailer-from)
|
(cm/replace-all-matching-values-by-new-value "FROM" mailer-from)
|
||||||
(cm/replace-all-matching-values-by-new-value "HOSTANDPORT" mailer-host-port)
|
(cm/replace-all-matching-values-by-new-value "HOSTANDPORT" mailer-host-port)
|
||||||
(cm/replace-all-matching-values-by-new-value "WHITELISTDOMAINS" mailer-domain-whitelist)
|
(cm/replace-all-matching-values-by-new-value "WHITELISTDOMAINS" service-domain-whitelist)
|
||||||
(cm/replace-all-matching-values-by-new-value "NOREPLY" service-noreply-address))))
|
(cm/replace-all-matching-values-by-new-value "NOREPLY" service-noreply-address))))
|
||||||
|
|
||||||
(defn-spec generate-secrets pred/map-or-seq?
|
(defn-spec generate-secrets pred/map-or-seq?
|
||||||
|
@ -102,4 +102,5 @@
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "gitea/certificate.yaml")
|
(yaml/load-as-edn "gitea/certificate.yaml")
|
||||||
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer)
|
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer)
|
||||||
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn))))
|
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn))))
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
(st/instrument `cut/generate-secrets)
|
(st/instrument `cut/generate-secrets)
|
||||||
|
|
||||||
(deftest should-generate-appini-env
|
(deftest should-generate-appini-env
|
||||||
(is (= {:GITEA__DEFAULT__APP_NAME-c1 "",
|
(is (= {:APP_NAME-c1 "",
|
||||||
:GITEA__DEFAULT__APP_NAME-c2 "test gitea",
|
:APP_NAME-c2 "test gitea",
|
||||||
:GITEA__mailer__FROM-c1 "",
|
:GITEA__mailer__FROM-c1 "",
|
||||||
:GITEA__mailer__FROM-c2 "test@test.com",
|
:GITEA__mailer__FROM-c2 "test@test.com",
|
||||||
:GITEA__mailer__HOST-c1 "",
|
:GITEA__mailer__HOST-c1 "",
|
||||||
|
@ -32,14 +32,14 @@
|
||||||
:fqdn ""
|
:fqdn ""
|
||||||
:mailer-from ""
|
:mailer-from ""
|
||||||
:mailer-host-port ""
|
:mailer-host-port ""
|
||||||
:service-whitelist-domains ""
|
:service-domain-whitelist ""
|
||||||
:service-noreply-address ""
|
:service-noreply-address ""
|
||||||
})
|
})
|
||||||
(cut/generate-appini-env {:default-app-name "test gitea"
|
(cut/generate-appini-env {:default-app-name "test gitea"
|
||||||
:fqdn "test.com"
|
:fqdn "test.com"
|
||||||
:mailer-from "test@test.com"
|
:mailer-from "test@test.com"
|
||||||
:mailer-host-port "mail.test.com:123"
|
:mailer-host-port "mail.test.com:123"
|
||||||
:service-whitelist-domains "test.com,test.net"
|
:service-domain-whitelist "test.com,test.net"
|
||||||
:service-noreply-address "noreply@test.com"
|
:service-noreply-address "noreply@test.com"
|
||||||
})))))
|
})))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue