| #!/bin/sh |
| |
| set -e |
| |
| config=/var/gerrit/etc/gerrit.config |
| |
| { |
| git config -f ${config} --unset-all auth.trustedOpenID || true |
| git config -f ${config} auth.gitBasicAuthPolicy HTTP |
| git config -f ${config} auth.type OAUTH |
| } |
| |
| if [ "${GITHUB_OAUTH_CLIENT_ID}" -a "${GITHUB_OAUTH_CLIENT_SECRET}" ]; then |
| git config -f ${config} \ |
| plugin.gerrit-oauth-provider-github-oauth.root-url "https://github.com/" |
| git config -f ${config} \ |
| plugin.gerrit-oauth-provider-github-oauth.client-id "${GITHUB_OAUTH_CLIENT_ID}" |
| git config -f ${config} \ |
| plugin.gerrit-oauth-provider-github-oauth.client-secret "${GITHUB_OAUTH_CLIENT_SECRET}" |
| fi |
| |
| if [ "${GERRIT_USER_EMAIL}" -a "${GERRIT_MAIL_PASSWORD}" ]; then |
| git config -f ${config} user.email ${GERRIT_USER_EMAIL} |
| git config -f ${config} sendemail.smtpServer mail.${SA_PUBLIC_DOMAIN_NAME} |
| git config -f ${config} sendemail.smtpServerPort 465 |
| git config -f ${config} sendemail.smtpEncryption ssl |
| git config -f ${config} sendemail.smtpUser ${GERRIT_USER_EMAIL} |
| git config -f ${config} sendemail.smtpPass ${GERRIT_MAIL_PASSWORD} |
| git config -f ${config} sendemail.html false |
| fi |
| |
| if [ "${GERRIT_KC_PASSWORD}" ]; then |
| kc_oauth=plugin.gerrit-oauth-provider-keycloak-oauth |
| |
| git config -f ${config} ${kc_oauth}.root-url https://id.${SA_PUBLIC_DOMAIN_NAME}/ |
| git config -f ${config} ${kc_oauth}.realm sourcearcade |
| git config -f ${config} ${kc_oauth}.client-id gerrit |
| git config -f ${config} ${kc_oauth}.client-secret ${GERRIT_KC_PASSWORD} |
| git config -f ${config} ${kc_oauth}.use-preferred-username true |
| fi |
| |
| exec /entrypoint.sh "$@" |