blob: 5af70c9e1e45c9f2cc434c1cb173e402e3811c53 [file] [log] [blame]
Nico Hubera1a296f2023-06-25 10:07:07 +00001#!/bin/sh
2
3set -e
4
Nico Huber54073102023-06-25 11:36:59 +00005if [ "${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}"
12fi
13
Nico Huberb650ed42023-07-20 17:08:54 +000014secret=/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
23if [ "${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
33fi
34
Nico Hubera1a296f2023-06-25 10:07:07 +000035exec /entrypoint.sh "$@"