From 9113bc267710a423ab1db98ceef23379e14d93f3 Mon Sep 17 00:00:00 2001 From: erik Date: Fri, 15 Jul 2022 13:48:09 +0200 Subject: [PATCH] Removed meissa-specifics Moved database user and pw to secrets.yaml --- src/main/cljc/dda/c4k_gitea/gitea.cljc | 20 +++++++++++-------- .../resources/gitea/appini-env-configmap.yaml | 20 +++++++++++++------ src/main/resources/gitea/secrets.yaml | 3 +++ valid-auth.edn | 4 ++-- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/main/cljc/dda/c4k_gitea/gitea.cljc b/src/main/cljc/dda/c4k_gitea/gitea.cljc index 22811cc..c3f3c7e 100644 --- a/src/main/cljc/dda/c4k_gitea/gitea.cljc +++ b/src/main/cljc/dda/c4k_gitea/gitea.cljc @@ -43,22 +43,26 @@ (defn-spec generate-appini-env pred/map-or-seq? ; TODO: fix this to require the merged spec of auth and config instead of any [config any?] - (let [{:keys [postgres-db-user postgres-db-password fqdn]} config] + (let [{:keys [fqdn mailer-from mailer-host mailer-port service-whitelist-domains]} config] (-> - (yaml/load-as-edn "gitea/appini-env-configmap.yaml") + (yaml/load-as-edn "gitea/appini-env-configmap.yaml") (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 "DBUSER" postgres-db-user) - (cm/replace-all-matching-values-by-new-value "DBPW" postgres-db-password)))) + (cm/replace-all-matching-values-by-new-value "FROM" mailer-from) + (cm/replace-all-matching-values-by-new-value "HOST" mailer-host) + (cm/replace-all-matching-values-by-new-value "PORT" mailer-port) + (cm/replace-all-matching-values-by-new-value "WHITELISTDOMAINS" service-whitelist-domains) + ))) (defn-spec generate-secrets pred/map-or-seq? [auth auth?] - (let [{:keys [maileruser mailerpw]} auth] + (let [{:keys [postgres-db-user postgres-db-password mailer-user mailer-pw]} auth] (-> (yaml/load-as-edn "gitea/secrets.yaml") - (cm/replace-all-matching-values-by-new-value "MAILERUSER" (b64/encode maileruser)) - (cm/replace-all-matching-values-by-new-value "MAILERPW" (b64/encode mailerpw)) - ))) + (cm/replace-all-matching-values-by-new-value "DBUSER" postgres-db-user) + (cm/replace-all-matching-values-by-new-value "DBPW" postgres-db-password) + (cm/replace-all-matching-values-by-new-value "MAILERUSER" (b64/encode mailer-user)) + (cm/replace-all-matching-values-by-new-value "MAILERPW" (b64/encode mailer-pw))))) (defn-spec generate-ingress pred/map-or-seq? [config config?] diff --git a/src/main/resources/gitea/appini-env-configmap.yaml b/src/main/resources/gitea/appini-env-configmap.yaml index f6fb5be..e7e75a0 100644 --- a/src/main/resources/gitea/appini-env-configmap.yaml +++ b/src/main/resources/gitea/appini-env-configmap.yaml @@ -7,16 +7,24 @@ data: GITEA__database__DB_TYPE: "postgres" GITEA__database__HOST: "postgresql-service:5432" # Service.Namespace.svc.cluster.local GITEA__database__NAME: gitea - GITEA__database__USER: DBUSER - GITEA__database__PASSWD: DBPW - + GITEA__server__DOMAIN: FQDN GITEA__server__ROOT_URL: URL GITEA__mailer__ENABLED: "true" - GITEA__mailer__FROM: gitea@meissa-gmbh.de + GITEA__mailer__FROM: FROM GITEA__mailer__MAILER_TYPE: smtp - GITEA__mailer__HOST: mail.routing.net:465 + GITEA__mailer__HOST: HOST:PORT GITEA__mailer__IS_TLS_ENABLED: "true" - GITEA__service__DISABLE_REGISTRATION: "true" \ No newline at end of file + GITEA__service__DISABLE_REGISTRATION: "true" + GITEA__service__REQUIRE_SIGNIN_VIEW: "false" + GITEA__service__REGISTER_EMAIL_CONFIRM: "false" + GITEA__service__ENABLE_NOTIFY_MAIL: "false" + GITEA__service__EMAIL_DOMAIN_WHITELIST: WHITELISTDOMAINS + GITEA__service__ALLOW_ONLY_EXTERNAL_REGISTRATION: "false" + GITEA__service__ENABLE_CAPTCHA: "false" + GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE: "true" + GITEA__service__DEFAULT_ALLOW_CREATE_ORGANIZATION: "true" + GITEA__service__DEFAULT_ENABLE_TIMETRACKING: "true" + GITEA__service__NO_REPLY_ADDRESS: noreply \ No newline at end of file diff --git a/src/main/resources/gitea/secrets.yaml b/src/main/resources/gitea/secrets.yaml index 0ec9d9c..80feb13 100644 --- a/src/main/resources/gitea/secrets.yaml +++ b/src/main/resources/gitea/secrets.yaml @@ -3,6 +3,9 @@ kind: Secret metadata: name: gitea-secrets data: + GITEA__database__USER: DBUSER + GITEA__database__PASSWD: DBPW + GITEA__mailer__USER: MAILERUSER GITEA__mailer__PASSWD: MAILERPW \ No newline at end of file diff --git a/valid-auth.edn b/valid-auth.edn index a85bf1a..a2bf50e 100644 --- a/valid-auth.edn +++ b/valid-auth.edn @@ -1,4 +1,4 @@ {:postgres-db-user "gitea" :postgres-db-password "gitea-db-password" - :maileruser "" - :mailerpw ""} + :mailer-user "" + :mailer-pw ""}