TODOs resolved
This commit is contained in:
parent
8a2156b907
commit
e1929dd312
4 changed files with 22 additions and 16 deletions
|
@ -5,7 +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.6"]
|
[org.clojure/tools.reader "1.3.6"]
|
||||||
[org.domaindrivenarchitecture/c4k-common-clj "3.0.0"]
|
[org.domaindrivenarchitecture/c4k-common-clj "3.0.1"]
|
||||||
[hickory "0.7.1"]]
|
[hickory "0.7.1"]]
|
||||||
:target-path "target/%s/"
|
:target-path "target/%s/"
|
||||||
:source-paths ["src/main/cljc"
|
:source-paths ["src/main/cljc"
|
||||||
|
|
|
@ -15,19 +15,21 @@
|
||||||
(s/def ::default-app-name string?)
|
(s/def ::default-app-name string?)
|
||||||
(s/def ::fqdn pred/fqdn-string?)
|
(s/def ::fqdn pred/fqdn-string?)
|
||||||
(s/def ::mailer-from pred/bash-env-string?)
|
(s/def ::mailer-from pred/bash-env-string?)
|
||||||
(s/def ::mailer-host-port pred/host-and-port-string?)
|
(s/def ::mailer-host pred/fqdn-string?)
|
||||||
|
(s/def ::mailer-port pred/port-number?)
|
||||||
(s/def ::service-domain-whitelist #(pred/string-of-separated-by? pred/fqdn-string? #"," %))
|
(s/def ::service-domain-whitelist #(pred/string-of-separated-by? pred/fqdn-string? #"," %))
|
||||||
(s/def ::service-noreply-address string?)
|
(s/def ::service-noreply-address 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?)
|
||||||
(s/def ::issuer pred/letsencrypt-issuer?)
|
(s/def ::issuer pred/letsencrypt-issuer?)
|
||||||
(s/def ::volume-total-storage-size int?) ;TODO extend this for checking lower size limits
|
(s/def ::volume-total-storage-size (partial pred/int-gt-n? 5))
|
||||||
|
|
||||||
(def config-defaults {:issuer "staging"})
|
(def config-defaults {:issuer "staging"})
|
||||||
|
|
||||||
(def config? (s/keys :req-un [::fqdn
|
(def config? (s/keys :req-un [::fqdn
|
||||||
::mailer-from
|
::mailer-from
|
||||||
::mailer-host-port
|
::mailer-host
|
||||||
|
::mailer-port
|
||||||
::service-noreply-address]
|
::service-noreply-address]
|
||||||
:opt-un [::issuer
|
:opt-un [::issuer
|
||||||
::default-app-name
|
::default-app-name
|
||||||
|
@ -47,10 +49,7 @@
|
||||||
|
|
||||||
(defn data-storage-by-volume-size
|
(defn data-storage-by-volume-size
|
||||||
[total root]
|
[total root]
|
||||||
(cond
|
(- total root))
|
||||||
(and (<= total 20) (> total 5)) (- total root)
|
|
||||||
(and (<= total 100) (> total 20)) (- total root)
|
|
||||||
(> total 100) (- total root)))
|
|
||||||
|
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
|
@ -76,7 +75,8 @@
|
||||||
(let [{:keys [default-app-name
|
(let [{:keys [default-app-name
|
||||||
fqdn
|
fqdn
|
||||||
mailer-from
|
mailer-from
|
||||||
mailer-host-port
|
mailer-host
|
||||||
|
mailer-port
|
||||||
service-domain-whitelist
|
service-domain-whitelist
|
||||||
service-noreply-address]
|
service-noreply-address]
|
||||||
:or {default-app-name "Gitea instance"
|
:or {default-app-name "Gitea instance"
|
||||||
|
@ -88,7 +88,8 @@
|
||||||
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn)
|
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn)
|
||||||
(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 "MAILER_HOST" mailer-host)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "MAILER_PORT" mailer-port)
|
||||||
(cm/replace-all-matching-values-by-new-value "WHITELISTDOMAINS" service-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))))
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,9 @@ data:
|
||||||
GITEA__mailer__ENABLED: "true"
|
GITEA__mailer__ENABLED: "true"
|
||||||
GITEA__mailer__FROM: FROM
|
GITEA__mailer__FROM: FROM
|
||||||
GITEA__mailer__MAILER_TYPE: smtp+startls
|
GITEA__mailer__MAILER_TYPE: smtp+startls
|
||||||
# TODO: jem 2022-08-02: outdated, use SMTP_ADDR & SMTP_PORT instead
|
GITEA__mailer__SMTP_ADDR: MAILER_HOST
|
||||||
GITEA__mailer__HOST: HOSTANDPORT
|
GITEA__mailer__SMTP_PORT: MAILER_PORT
|
||||||
|
|
||||||
|
|
||||||
#[oauth2]
|
#[oauth2]
|
||||||
GITEA__oauth2__ENABLE: "true"
|
GITEA__oauth2__ENABLE: "true"
|
||||||
|
|
|
@ -16,8 +16,10 @@
|
||||||
: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 "m.t.de:123",
|
:GITEA__mailer__SMTP_ADDR-c1 "m.t.de",
|
||||||
:GITEA__mailer__HOST-c2 "mail.test.com:123",
|
:GITEA__mailer__SMTP_PORT-c1 123,
|
||||||
|
:GITEA__mailer__SMTP_ADDR-c2 "mail.test.com",
|
||||||
|
:GITEA__mailer__SMTP_PORT-c2 456,
|
||||||
:GITEA__server__DOMAIN-c1 "test.de",
|
:GITEA__server__DOMAIN-c1 "test.de",
|
||||||
:GITEA__server__DOMAIN-c2 "test.com",
|
:GITEA__server__DOMAIN-c2 "test.com",
|
||||||
:GITEA__server__ROOT_URL-c1 "https://test.de",
|
:GITEA__server__ROOT_URL-c1 "https://test.de",
|
||||||
|
@ -31,14 +33,16 @@
|
||||||
(th/map-diff (cut/generate-appini-env {:default-app-name ""
|
(th/map-diff (cut/generate-appini-env {:default-app-name ""
|
||||||
:fqdn "test.de"
|
:fqdn "test.de"
|
||||||
:mailer-from ""
|
:mailer-from ""
|
||||||
:mailer-host-port "m.t.de:123"
|
:mailer-host "m.t.de"
|
||||||
|
:mailer-port 123
|
||||||
:service-domain-whitelist "adb.de"
|
:service-domain-whitelist "adb.de"
|
||||||
: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 "mail.test.com"
|
||||||
|
:mailer-port 456
|
||||||
:service-domain-whitelist "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