blob: 9976ae5df5238a009edb56c3d2898b0162cb290b [file] [log] [blame]
Nico Hubera1a296f2023-06-25 10:07:07 +00001#!/bin/sh
2
3set -e
4
Nico Huberf0201522023-07-21 13:59:04 +00005config=/var/gerrit/etc/gerrit.config
6
Nico Huberd9d54fe2023-07-21 04:07:05 +00007{
Nico Huberf0201522023-07-21 13:59:04 +00008 git config -f ${config} --unset-all auth.trustedOpenID || true
Nico Huber2a939a02023-07-25 21:48:52 +00009 git config -f ${config} auth.gitBasicAuthPolicy HTTP
10 git config -f ${config} auth.type OAUTH
Nico Huberd9d54fe2023-07-21 04:07:05 +000011}
12
Nico Huber54073102023-06-25 11:36:59 +000013if [ "${GITHUB_OAUTH_CLIENT_ID}" -a "${GITHUB_OAUTH_CLIENT_SECRET}" ]; then
Nico Huberf0201522023-07-21 13:59:04 +000014 git config -f ${config} \
Nico Huber54073102023-06-25 11:36:59 +000015 plugin.gerrit-oauth-provider-github-oauth.root-url "https://github.com/"
Nico Huberf0201522023-07-21 13:59:04 +000016 git config -f ${config} \
Nico Huber54073102023-06-25 11:36:59 +000017 plugin.gerrit-oauth-provider-github-oauth.client-id "${GITHUB_OAUTH_CLIENT_ID}"
Nico Huberf0201522023-07-21 13:59:04 +000018 git config -f ${config} \
Nico Huber54073102023-06-25 11:36:59 +000019 plugin.gerrit-oauth-provider-github-oauth.client-secret "${GITHUB_OAUTH_CLIENT_SECRET}"
20fi
21
Nico Huber177e6102023-07-25 13:39:16 +000022if [ "${GERRIT_USER_EMAIL}" -a "${GERRIT_MAIL_PASSWORD}" ]; then
Nico Huberf0201522023-07-21 13:59:04 +000023 git config -f ${config} user.email ${GERRIT_USER_EMAIL}
24 git config -f ${config} sendemail.smtpServer mail.${SA_PUBLIC_DOMAIN_NAME}
25 git config -f ${config} sendemail.smtpServerPort 465
26 git config -f ${config} sendemail.smtpEncryption ssl
27 git config -f ${config} sendemail.smtpUser ${GERRIT_USER_EMAIL}
Nico Huber177e6102023-07-25 13:39:16 +000028 git config -f ${config} sendemail.smtpPass ${GERRIT_MAIL_PASSWORD}
Nico Huberf0201522023-07-21 13:59:04 +000029 git config -f ${config} sendemail.html false
Nico Huberb650ed42023-07-20 17:08:54 +000030fi
31
Nico Huber7f8dc5b2023-07-25 16:48:01 +000032if [ "${GERRIT_KC_PASSWORD}" ]; then
33 kc_oauth=plugin.gerrit-oauth-provider-keycloak-oauth
34
35 git config -f ${config} ${kc_oauth}.root-url https://id.${SA_PUBLIC_DOMAIN_NAME}/
36 git config -f ${config} ${kc_oauth}.realm sourcearcade
37 git config -f ${config} ${kc_oauth}.client-id gerrit
38 git config -f ${config} ${kc_oauth}.client-secret ${GERRIT_KC_PASSWORD}
39 git config -f ${config} ${kc_oauth}.use-preferred-username true
Nico Huber7f8dc5b2023-07-25 16:48:01 +000040fi
41
Nico Hubera1a296f2023-06-25 10:07:07 +000042exec /entrypoint.sh "$@"