Nico Huber | a1a296f | 2023-06-25 10:07:07 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
Nico Huber | 5407310 | 2023-06-25 11:36:59 +0000 | [diff] [blame] | 5 | if [ "${GITHUB_OAUTH_CLIENT_ID}" -a "${GITHUB_OAUTH_CLIENT_SECRET}" ]; then |
| 6 | git config -f /var/gerrit/etc/gerrit.config \ |
| 7 | plugin.gerrit-oauth-provider-github-oauth.root-url "https://github.com/" |
| 8 | git config -f /var/gerrit/etc/gerrit.config \ |
| 9 | plugin.gerrit-oauth-provider-github-oauth.client-id "${GITHUB_OAUTH_CLIENT_ID}" |
| 10 | git config -f /var/gerrit/etc/gerrit.config \ |
| 11 | plugin.gerrit-oauth-provider-github-oauth.client-secret "${GITHUB_OAUTH_CLIENT_SECRET}" |
| 12 | fi |
| 13 | |
Nico Huber | b650ed4 | 2023-07-20 17:08:54 +0000 | [diff] [blame^] | 14 | secret=/var/gerrit/passwd/secret |
| 15 | |
| 16 | { |
| 17 | if [ ! -f ${secret} ]; then |
| 18 | echo $(mktemp -u XXXXXXXXXXXXXXXX) >${secret} |
| 19 | fi |
| 20 | chmod 400 ${secret} |
| 21 | } |
| 22 | |
| 23 | if [ "${GERRIT_USER_EMAIL}" ]; then |
| 24 | passwd=$(cat ${secret}) |
| 25 | |
| 26 | git config -f /etc/gerrit/gerrit.config user.email ${GERRIT_USER_EMAIL} |
| 27 | git config -f /etc/gerrit/gerrit.config sendemail.smtpServer mail.${SA_PUBLIC_DOMAIN_NAME} |
| 28 | git config -f /etc/gerrit/gerrit.config sendemail.smtpServerPort 465 |
| 29 | git config -f /etc/gerrit/gerrit.config sendemail.smtpEncryption ssl |
| 30 | git config -f /etc/gerrit/gerrit.config sendemail.smtpUser ${GERRIT_USER_EMAIL} |
| 31 | git config -f /etc/gerrit/gerrit.config sendemail.smtpPass ${passwd} |
| 32 | git config -f /etc/gerrit/gerrit.config sendemail.html false |
| 33 | fi |
| 34 | |
Nico Huber | a1a296f | 2023-06-25 10:07:07 +0000 | [diff] [blame] | 35 | exec /entrypoint.sh "$@" |