parent
e733cbe016
commit
42f6542b49
6 changed files with 20 additions and 30 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.1"]
|
[org.domaindrivenarchitecture/c4k-common-clj "3.0.0"]
|
||||||
[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,21 +15,19 @@
|
||||||
(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 pred/fqdn-string?)
|
(s/def ::mailer-host-port pred/host-and-port-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 (partial pred/int-gt-n? 5))
|
(s/def ::volume-total-storage-size int?) ;TODO extend this for checking lower size limits
|
||||||
|
|
||||||
(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
|
::mailer-host-port
|
||||||
::mailer-port
|
|
||||||
::service-noreply-address]
|
::service-noreply-address]
|
||||||
:opt-un [::issuer
|
:opt-un [::issuer
|
||||||
::default-app-name
|
::default-app-name
|
||||||
|
@ -49,7 +47,10 @@
|
||||||
|
|
||||||
(defn data-storage-by-volume-size
|
(defn data-storage-by-volume-size
|
||||||
[total root]
|
[total root]
|
||||||
(- total root))
|
(cond
|
||||||
|
(and (<= total 20) (> total 5)) (- total root)
|
||||||
|
(and (<= total 100) (> total 20)) (- total root)
|
||||||
|
(> total 100) (- total root)))
|
||||||
|
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
|
@ -75,8 +76,7 @@
|
||||||
(let [{:keys [default-app-name
|
(let [{:keys [default-app-name
|
||||||
fqdn
|
fqdn
|
||||||
mailer-from
|
mailer-from
|
||||||
mailer-host
|
mailer-host-port
|
||||||
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,8 +88,7 @@
|
||||||
(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 "MAILER_HOST" mailer-host)
|
(cm/replace-all-matching-values-by-new-value "HOSTANDPORT" mailer-host-port)
|
||||||
(cm/replace-all-matching-values-by-new-value "MAILER_PORT" (str 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))))
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,7 @@
|
||||||
(cm/concat-vec
|
(cm/concat-vec
|
||||||
(br/generate-input-field "fqdn" "Your fqdn:" "repo.test.de")
|
(br/generate-input-field "fqdn" "Your fqdn:" "repo.test.de")
|
||||||
(br/generate-input-field "mailer-from" "Your mailer email address:" "test@test.de")
|
(br/generate-input-field "mailer-from" "Your mailer email address:" "test@test.de")
|
||||||
(br/generate-input-field "mailer-host" "Your mailer host address:" "test.de")
|
(br/generate-input-field "mailer-host-port" "Your mailer host with port:" "test.de:123")
|
||||||
(br/generate-input-field "mailer-port" "Your mailer port number:" "123")
|
|
||||||
(br/generate-input-field "service-noreply-address" "Your noreply domain:" "test.de")
|
(br/generate-input-field "service-noreply-address" "Your noreply domain:" "test.de")
|
||||||
(br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "")
|
(br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "")
|
||||||
(br/generate-input-field "app-name" "(Optional) Your app name:" "")
|
(br/generate-input-field "app-name" "(Optional) Your app name:" "")
|
||||||
|
@ -77,8 +76,7 @@
|
||||||
(defn validate-all! []
|
(defn validate-all! []
|
||||||
(br/validate! "fqdn" ::gitea/fqdn)
|
(br/validate! "fqdn" ::gitea/fqdn)
|
||||||
(br/validate! "mailer-from" ::gitea/mailer-from)
|
(br/validate! "mailer-from" ::gitea/mailer-from)
|
||||||
(br/validate! "mailer-host" ::gitea/mailer-host)
|
(br/validate! "mailer-host-port" ::gitea/mailer-host-port)
|
||||||
(br/validate! "mailer-port" ::gitea/mailer-port)
|
|
||||||
(br/validate! "service-noreply-address" ::gitea/service-noreply-address)
|
(br/validate! "service-noreply-address" ::gitea/service-noreply-address)
|
||||||
(br/validate! "issuer" ::gitea/issuer :optional true :deserializer keyword)
|
(br/validate! "issuer" ::gitea/issuer :optional true :deserializer keyword)
|
||||||
(br/validate! "app-name" ::gitea/default-app-name)
|
(br/validate! "app-name" ::gitea/default-app-name)
|
||||||
|
@ -106,8 +104,7 @@
|
||||||
(br/set-output!)))))
|
(br/set-output!)))))
|
||||||
(add-validate-listener "fqdn")
|
(add-validate-listener "fqdn")
|
||||||
(add-validate-listener "mailer-from")
|
(add-validate-listener "mailer-from")
|
||||||
(add-validate-listener "mailer-host")
|
(add-validate-listener "mailer-host-port")
|
||||||
(add-validate-listener "mailer-port")
|
|
||||||
(add-validate-listener "service-noreply-address")
|
(add-validate-listener "service-noreply-address")
|
||||||
(add-validate-listener "app-name")
|
(add-validate-listener "app-name")
|
||||||
(add-validate-listener "domain-whitelist")
|
(add-validate-listener "domain-whitelist")
|
||||||
|
|
|
@ -38,9 +38,8 @@ 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
|
||||||
GITEA__mailer__SMTP_ADDR: MAILER_HOST
|
# TODO: jem 2022-08-02: outdated, use SMTP_ADDR & SMTP_PORT instead
|
||||||
GITEA__mailer__SMTP_PORT: MAILER_PORT
|
GITEA__mailer__HOST: HOSTANDPORT
|
||||||
|
|
||||||
|
|
||||||
#[oauth2]
|
#[oauth2]
|
||||||
GITEA__oauth2__ENABLE: "true"
|
GITEA__oauth2__ENABLE: "true"
|
||||||
|
|
|
@ -16,10 +16,8 @@
|
||||||
: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__SMTP_ADDR-c1 "m.t.de",
|
:GITEA__mailer__HOST-c1 "m.t.de:123",
|
||||||
:GITEA__mailer__SMTP_PORT-c1 "123",
|
:GITEA__mailer__HOST-c2 "mail.test.com: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",
|
||||||
|
@ -33,16 +31,14 @@
|
||||||
(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 "m.t.de"
|
:mailer-host-port "m.t.de:123"
|
||||||
: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 "mail.test.com"
|
:mailer-host-port "mail.test.com:123"
|
||||||
: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"
|
||||||
})))))
|
})))))
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
:fqdn "test.de"
|
:fqdn "test.de"
|
||||||
:issuer "staging"
|
:issuer "staging"
|
||||||
:mailer-from "test@test.de"
|
:mailer-from "test@test.de"
|
||||||
:mailer-host "test.de"
|
:mailer-host-port "test.de:123"
|
||||||
:mailer-port 123
|
|
||||||
:service-whitelist-domains "test.de"
|
:service-whitelist-domains "test.de"
|
||||||
:service-noreply-address "noreply@test.de"
|
:service-noreply-address "noreply@test.de"
|
||||||
:volume-total-storage-size 6
|
:volume-total-storage-size 6
|
||||||
|
|
Loading…
Reference in a new issue