Nico Huber | a1a296f | 2023-06-25 10:07:07 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
Nico Huber | f020152 | 2023-07-21 13:59:04 +0000 | [diff] [blame] | 5 | config=/var/gerrit/etc/gerrit.config |
| 6 | |
Nico Huber | d9d54fe | 2023-07-21 04:07:05 +0000 | [diff] [blame] | 7 | { |
Nico Huber | f020152 | 2023-07-21 13:59:04 +0000 | [diff] [blame] | 8 | git config -f ${config} --unset-all auth.trustedOpenID || true |
| 9 | git config -f ${config} --add auth.trustedOpenID https:// |
| 10 | git config -f ${config} --add auth.trustedOpenID imported: |
Nico Huber | d9d54fe | 2023-07-21 04:07:05 +0000 | [diff] [blame] | 11 | } |
| 12 | |
Nico Huber | 5407310 | 2023-06-25 11:36:59 +0000 | [diff] [blame] | 13 | if [ "${GITHUB_OAUTH_CLIENT_ID}" -a "${GITHUB_OAUTH_CLIENT_SECRET}" ]; then |
Nico Huber | f020152 | 2023-07-21 13:59:04 +0000 | [diff] [blame] | 14 | git config -f ${config} \ |
Nico Huber | 5407310 | 2023-06-25 11:36:59 +0000 | [diff] [blame] | 15 | plugin.gerrit-oauth-provider-github-oauth.root-url "https://github.com/" |
Nico Huber | f020152 | 2023-07-21 13:59:04 +0000 | [diff] [blame] | 16 | git config -f ${config} \ |
Nico Huber | 5407310 | 2023-06-25 11:36:59 +0000 | [diff] [blame] | 17 | plugin.gerrit-oauth-provider-github-oauth.client-id "${GITHUB_OAUTH_CLIENT_ID}" |
Nico Huber | f020152 | 2023-07-21 13:59:04 +0000 | [diff] [blame] | 18 | git config -f ${config} \ |
Nico Huber | 5407310 | 2023-06-25 11:36:59 +0000 | [diff] [blame] | 19 | plugin.gerrit-oauth-provider-github-oauth.client-secret "${GITHUB_OAUTH_CLIENT_SECRET}" |
Nico Huber | f020152 | 2023-07-21 13:59:04 +0000 | [diff] [blame] | 20 | git config -f ${config} --add auth.trustedOpenID github-oauth: |
Nico Huber | 5407310 | 2023-06-25 11:36:59 +0000 | [diff] [blame] | 21 | fi |
| 22 | |
Nico Huber | 177e610 | 2023-07-25 13:39:16 +0000 | [diff] [blame] | 23 | if [ "${GERRIT_USER_EMAIL}" -a "${GERRIT_MAIL_PASSWORD}" ]; then |
Nico Huber | f020152 | 2023-07-21 13:59:04 +0000 | [diff] [blame] | 24 | git config -f ${config} user.email ${GERRIT_USER_EMAIL} |
| 25 | git config -f ${config} sendemail.smtpServer mail.${SA_PUBLIC_DOMAIN_NAME} |
| 26 | git config -f ${config} sendemail.smtpServerPort 465 |
| 27 | git config -f ${config} sendemail.smtpEncryption ssl |
| 28 | git config -f ${config} sendemail.smtpUser ${GERRIT_USER_EMAIL} |
Nico Huber | 177e610 | 2023-07-25 13:39:16 +0000 | [diff] [blame] | 29 | git config -f ${config} sendemail.smtpPass ${GERRIT_MAIL_PASSWORD} |
Nico Huber | f020152 | 2023-07-21 13:59:04 +0000 | [diff] [blame] | 30 | git config -f ${config} sendemail.html false |
Nico Huber | b650ed4 | 2023-07-20 17:08:54 +0000 | [diff] [blame] | 31 | fi |
| 32 | |
Nico Huber | 7f8dc5b | 2023-07-25 16:48:01 +0000 | [diff] [blame^] | 33 | if [ "${GERRIT_KC_PASSWORD}" ]; then |
| 34 | kc_oauth=plugin.gerrit-oauth-provider-keycloak-oauth |
| 35 | |
| 36 | git config -f ${config} ${kc_oauth}.root-url https://id.${SA_PUBLIC_DOMAIN_NAME}/ |
| 37 | git config -f ${config} ${kc_oauth}.realm sourcearcade |
| 38 | git config -f ${config} ${kc_oauth}.client-id gerrit |
| 39 | git config -f ${config} ${kc_oauth}.client-secret ${GERRIT_KC_PASSWORD} |
| 40 | git config -f ${config} ${kc_oauth}.use-preferred-username true |
| 41 | git config -f ${config} --add auth.trustedOpenID keycloak-oauth: |
| 42 | fi |
| 43 | |
Nico Huber | a1a296f | 2023-06-25 10:07:07 +0000 | [diff] [blame] | 44 | exec /entrypoint.sh "$@" |