Update deps, fix tests

This commit is contained in:
erik 2022-07-27 12:23:42 +02:00
parent 91feb38f57
commit 53eca49d9d
3 changed files with 13 additions and 60 deletions

View file

@ -5,7 +5,7 @@
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/tools.reader "1.3.6"]
[org.domaindrivenarchitecture/c4k-common-clj "2.1.0"]
[org.domaindrivenarchitecture/c4k-common-clj "2.1.2"]
[hickory "0.7.1"]]
:target-path "target/%s/"
:source-paths ["src/main/cljc"

View file

@ -17,20 +17,8 @@
(s/def ::default-app-name string?)
(s/def ::fqdn pred/fqdn-string?)
(s/def ::mailer-from pred/bash-env-string?)
; TODO: Move to pred/host-port?
; TODO: Review jem - 2022/07/26 - move to common & add unittest
(s/def ::mailer-host-port #(let [split-string (str/split % #":")]
(and (= (count split-string) 2)
(pred/fqdn-string? (first split-string))
; TODO: Move this to pred/port-number?
; TODO: Review jem - 2022/07/26 - move to common & add unittest
(let [snd (edn/read-string (second split-string))]
(and (integer? snd)
(> snd 0)
(<= snd 65535))))))
;TODO: Maybe move to pred/comma-separated-fqdn-list?
; TODO: Review jem - 2022/07/26 - move to common & add unittest
(s/def ::service-domain-whitelist #(every? true? (map pred/fqdn-string? (str/split % #","))))
(s/def ::mailer-host-port pred/host-and-port-string?)
(s/def ::service-domain-whitelist #(pred/string-of-separated-by? pred/fqdn-string? #"," %))
(s/def ::service-noreply-address string?)
(s/def ::mailer-user pred/bash-env-string?)
(s/def ::mailer-pw pred/bash-env-string?)
@ -60,9 +48,8 @@
(defmethod yaml/load-as-edn :gitea [resource-name]
(yaml/from-string (yaml/load-resource resource-name))))
(defn-spec generate-appini-env pred/map-or-seq?
; TODO: Review jem - 2022/07/26 - as we do not need auth here just hand over config & spec it.
[config any?]
(defn-spec generate-appini-env pred/map-or-seq?
[config config?]
(let [{:keys [default-app-name
fqdn
mailer-from

View file

@ -16,23 +16,23 @@
:APP_NAME-c2 "test gitea",
:GITEA__mailer__FROM-c1 "",
:GITEA__mailer__FROM-c2 "test@test.com",
:GITEA__mailer__HOST-c1 "",
:GITEA__mailer__HOST-c1 "m.t.de:123",
:GITEA__mailer__HOST-c2 "mail.test.com:123",
:GITEA__server__DOMAIN-c1 "",
:GITEA__server__DOMAIN-c1 "test.de",
:GITEA__server__DOMAIN-c2 "test.com",
:GITEA__server__ROOT_URL-c1 "https://",
:GITEA__server__ROOT_URL-c1 "https://test.de",
:GITEA__server__ROOT_URL-c2 "https://test.com",
:GITEA__server__SSH_DOMAIN-c1 "",
:GITEA__server__SSH_DOMAIN-c1 "test.de",
:GITEA__server__SSH_DOMAIN-c2 "test.com",
:GITEA__service__EMAIL_DOMAIN_WHITELIST-c1 "",
:GITEA__service__EMAIL_DOMAIN_WHITELIST-c1 "adb.de",
:GITEA__service__EMAIL_DOMAIN_WHITELIST-c2 "test.com,test.net",
:GITEA__service__NO_REPLY_ADDRESS-c1 "",
:GITEA__service__NO_REPLY_ADDRESS-c2 "noreply@test.com"}
(ct/map-diff (cut/generate-appini-env {:default-app-name ""
:fqdn ""
:fqdn "test.de"
:mailer-from ""
:mailer-host-port ""
:service-domain-whitelist ""
:mailer-host-port "m.t.de:123"
:service-domain-whitelist "adb.de"
:service-noreply-address ""
})
(cut/generate-appini-env {:default-app-name "test gitea"
@ -66,37 +66,3 @@
:mailer-user "maileruser"
:mailer-pw "mailerpw"})))))
(not
(=
{:GITEA__server__DOMAIN-c2 "test.com",
:GITEA__mailer__FROM-c1 "",
:GITEA__service__EMAIL_DOMAIN_WHITELIST-c2 "test.com,test.net",
:GITEA__service__EMAIL_DOMAIN_WHITELIST-c1 "",
:GITEA__mailer__HOST-c1 "",
:GITEA__service__NO_REPLY_ADDRESS-c1 "",
:GITEA__mailer__FROM-c2 "test@test.com",
:GITEA__mailer__HOST-c2 "mail.test.com:123",
:GITEA__server__ROOT_URL-c2 "https://test.com",
:GITEA__server__ROOT_URL-c1 "https://",
:GITEA__DEFAULT__APP_NAME-c2 "test gitea",
:GITEA__server__DOMAIN-c1 "",
:GITEA__DEFAULT__APP_NAME-c1 "",
:GITEA__service__NO_REPLY_ADDRESS-c2 "noreply@test.com"}
{:GITEA__server__DOMAIN-c2 "test.com",
:GITEA__mailer__FROM-c1 "",
:GITEA__service__EMAIL_DOMAIN_WHITELIST-c2 "test.com,test.net",
:GITEA__service__EMAIL_DOMAIN_WHITELIST-c1 "",
:GITEA__mailer__HOST-c1 "",
:GITEA__service__NO_REPLY_ADDRESS-c1 "",
:GITEA__mailer__FROM-c2 "test@test.com",
:GITEA__mailer__HOST-c2 "mail.test.com:123",
:GITEA__server__ROOT_URL-c2 "https://test.com",
:GITEA__server__SSH_DOMAIN-c1 "",
:GITEA__server__ROOT_URL-c1 "https://",
:GITEA__DEFAULT__APP_NAME-c2 "test gitea",
:GITEA__server__SSH_DOMAIN-c2 "test.com",
:GITEA__server__DOMAIN-c1 "",
:GITEA__DEFAULT__APP_NAME-c1 "",
:GITEA__service__NO_REPLY_ADDRESS-c2 "noreply@test.com"}))