Split mailer host into addr and port

This became possible in version 1.18. We are currently using 1.19
This commit is contained in:
bom 2023-04-28 11:57:18 +02:00
parent e9ee6136f3
commit 79157ea457
5 changed files with 22 additions and 12 deletions

View file

@ -12,7 +12,8 @@
(def config? (s/keys :req-un [::forgejo/fqdn
::forgejo/mailer-from
::forgejo/mailer-host-port
::forgejo/mailer-host
::forgejo/mailer-port
::forgejo/service-noreply-address]
:opt-un [::forgejo/issuer
::forgejo/default-app-name

View file

@ -23,7 +23,8 @@
(s/def ::default-app-name string?)
(s/def ::fqdn pred/fqdn-string?)
(s/def ::mailer-from pred/bash-env-string?)
(s/def ::mailer-host-port pred/host-and-port-string?)
(s/def ::mailer-host pred/bash-env-string?)
(s/def ::mailer-port pred/bash-env-string?)
(s/def ::service-domain-whitelist domain-list?)
(s/def ::service-noreply-address string?)
(s/def ::mailer-user pred/bash-env-string?)
@ -35,7 +36,8 @@
(def config? (s/keys :req-un [::fqdn
::mailer-from
::mailer-host-port
::mailer-host
::mailer-port
::service-noreply-address]
:opt-un [::issuer
::default-app-name
@ -66,7 +68,8 @@
(let [{:keys [default-app-name
fqdn
mailer-from
mailer-host-port
mailer-host
mailer-port
service-domain-whitelist
service-noreply-address]
:or {default-app-name "forgejo instance"
@ -78,7 +81,8 @@
(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 "FROM" mailer-from)
(cm/replace-all-matching-values-by-new-value "HOSTANDPORT" mailer-host-port)
(cm/replace-all-matching-values-by-new-value "MAILERHOST" mailer-host)
(cm/replace-all-matching-values-by-new-value "MAILERPORT" mailer-port)
(cm/replace-all-matching-values-by-new-value "WHITELISTDOMAINS" service-domain-whitelist)
(cm/replace-all-matching-values-by-new-value "NOREPLY" service-noreply-address))))

View file

@ -38,8 +38,8 @@ data:
FORGEJO__mailer__ENABLED: "true"
FORGEJO__mailer__FROM: FROM
FORGEJO__mailer__MAILER_TYPE: smtp+startls
# TODO: jem 2022-08-02: outdated with v1.18, use SMTP_ADDR & SMTP_PORT instead
FORGEJO__mailer__HOST: HOSTANDPORT
FORGEJO__mailer__SMTP_ADDR: MAILERHOST
FORGEJO__mailer__SMTP_PORT: MAILERPORT
#[oauth2]
FORGEJO__oauth2__ENABLE: "true"

View file

@ -16,8 +16,10 @@
:APP_NAME-c2 "test forgejo",
:FORGEJO__mailer__FROM-c1 "",
:FORGEJO__mailer__FROM-c2 "test@test.com",
:FORGEJO__mailer__HOST-c1 "m.t.de:123",
:FORGEJO__mailer__HOST-c2 "mail.test.com:123",
:FORGEJO__mailer__SMTP_ADDR-c1 "m.t.de",
:FORGEJO__mailer__SMTP_ADDR-c2 "mail.test.com",
:FORGEJO__mailer__SMTP_PORT-c1 "123",
:FORGEJO__mailer__SMTP_PORT-c2 "456",
:FORGEJO__server__DOMAIN-c1 "test.de",
:FORGEJO__server__DOMAIN-c2 "test.com",
:FORGEJO__server__ROOT_URL-c1 "https://test.de",
@ -31,14 +33,16 @@
(th/map-diff (cut/generate-appini-env {:default-app-name ""
:fqdn "test.de"
:mailer-from ""
:mailer-host-port "m.t.de:123"
:mailer-host "m.t.de"
:mailer-port "123"
:service-domain-whitelist "adb.de"
:service-noreply-address ""
})
(cut/generate-appini-env {:default-app-name "test forgejo"
:fqdn "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-noreply-address "noreply@test.com"
})))))

View file

@ -2,7 +2,8 @@ default-app-name: "Meissas awesome forgejo"
fqdn: "test.de"
issuer: "staging"
mailer-from: "test@test.de"
mailer-host-port: "test.de:123"
mailer-host: "test.de"
mailer-port: "123"
service-whitelist-domains: "test.de"
service-noreply-address: "noreply@test.de"
volume-total-storage-size: 6