From 0f626a040dc8cc4ca2f25d680942eb54e5768e8f Mon Sep 17 00:00:00 2001 From: Mirco Date: Thu, 1 Jun 2023 20:27:56 +0200 Subject: [PATCH] One failure remaining in Testdriven Design; Decision if federated true/false in forgejo.cljc not working --- src/main/cljc/dda/c4k_forgejo/forgejo.cljc | 19 ++++++++++++++----- .../forgejo/appini-env-configmap.yaml | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/cljc/dda/c4k_forgejo/forgejo.cljc b/src/main/cljc/dda/c4k_forgejo/forgejo.cljc index 48028d1..cd3becc 100644 --- a/src/main/cljc/dda/c4k_forgejo/forgejo.cljc +++ b/src/main/cljc/dda/c4k_forgejo/forgejo.cljc @@ -72,9 +72,11 @@ mailer-host mailer-port service-domain-whitelist - service-noreply-address] + service-noreply-address + federated] :or {default-app-name "forgejo instance" - service-domain-whitelist fqdn}} + service-domain-whitelist fqdn + federated false}} config] (-> (yaml/load-as-edn "forgejo/appini-env-configmap.yaml") @@ -85,7 +87,8 @@ (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)))) + (cm/replace-all-matching-values-by-new-value "NOREPLY" service-noreply-address) + (cm/replace-all-matching-values-by-new-value "FEDERATED" (str federated))))) (defn generate-secrets [auth] @@ -120,8 +123,14 @@ ; ToDo: Need to add federated-image-name to config? Or hardcode? ; ToDo: Need to add default image-name to config? Or hardcode? (defn-spec generate-deployment pred/map-or-seq? - [config config?] - (yaml/load-as-edn "forgejo/deployment.yaml")) + [config] + (let [{:keys [federated]} config] + + ; TODO: if + if (= federated true) + (-> + (yaml/load-as-edn "forgejo/deployment.yaml") + (cm/replace-all-matching-values-by-new-value "codeberg.org/forgejo/forgejo:1.19" "domaindrivenarchitecture/c4k-forgejo-fed")))) (defn generate-service [] diff --git a/src/main/resources/forgejo/appini-env-configmap.yaml b/src/main/resources/forgejo/appini-env-configmap.yaml index 632d02a..c9d8c33 100644 --- a/src/main/resources/forgejo/appini-env-configmap.yaml +++ b/src/main/resources/forgejo/appini-env-configmap.yaml @@ -24,7 +24,7 @@ data: RUN_USER: git #[federation] - FORGEJO__federation__ENABLED: "true" + FORGEJO__federation__ENABLED: FEDERATED #[indexer] FORGEJO__indexer__ISSUE_INDEXER_PATH: /data/gitea/indexers/issues.bleve