Update deps, fix tests
This commit is contained in:
parent
91feb38f57
commit
53eca49d9d
3 changed files with 13 additions and 60 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 "2.1.0"]
|
[org.domaindrivenarchitecture/c4k-common-clj "2.1.2"]
|
||||||
[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"
|
||||||
|
|
|
@ -17,20 +17,8 @@
|
||||||
(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?)
|
||||||
; TODO: Move to pred/host-port?
|
(s/def ::mailer-host-port pred/host-and-port-string?)
|
||||||
; TODO: Review jem - 2022/07/26 - move to common & add unittest
|
(s/def ::service-domain-whitelist #(pred/string-of-separated-by? pred/fqdn-string? #"," %))
|
||||||
(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 ::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?)
|
||||||
|
@ -60,9 +48,8 @@
|
||||||
(defmethod yaml/load-as-edn :gitea [resource-name]
|
(defmethod yaml/load-as-edn :gitea [resource-name]
|
||||||
(yaml/from-string (yaml/load-resource resource-name))))
|
(yaml/from-string (yaml/load-resource resource-name))))
|
||||||
|
|
||||||
(defn-spec generate-appini-env pred/map-or-seq?
|
(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 config?]
|
||||||
[config any?]
|
|
||||||
(let [{:keys [default-app-name
|
(let [{:keys [default-app-name
|
||||||
fqdn
|
fqdn
|
||||||
mailer-from
|
mailer-from
|
||||||
|
|
|
@ -16,23 +16,23 @@
|
||||||
: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 "m.t.de:123",
|
||||||
:GITEA__mailer__HOST-c2 "mail.test.com: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__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__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__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__EMAIL_DOMAIN_WHITELIST-c2 "test.com,test.net",
|
||||||
:GITEA__service__NO_REPLY_ADDRESS-c1 "",
|
:GITEA__service__NO_REPLY_ADDRESS-c1 "",
|
||||||
:GITEA__service__NO_REPLY_ADDRESS-c2 "noreply@test.com"}
|
:GITEA__service__NO_REPLY_ADDRESS-c2 "noreply@test.com"}
|
||||||
(ct/map-diff (cut/generate-appini-env {:default-app-name ""
|
(ct/map-diff (cut/generate-appini-env {:default-app-name ""
|
||||||
:fqdn ""
|
:fqdn "test.de"
|
||||||
:mailer-from ""
|
:mailer-from ""
|
||||||
:mailer-host-port ""
|
:mailer-host-port "m.t.de:123"
|
||||||
:service-domain-whitelist ""
|
: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"
|
||||||
|
@ -66,37 +66,3 @@
|
||||||
:mailer-user "maileruser"
|
:mailer-user "maileruser"
|
||||||
:mailer-pw "mailerpw"})))))
|
: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"}))
|
|
Loading…
Reference in a new issue