blob: b9951b894fe741d43969eca6a75e5f478f16a989 [file] [log] [blame]
Nico Hubera1a296f2023-06-25 10:07:07 +00001#!/bin/sh
2
3set -e
4
Nico Huberd9d54fe2023-07-21 04:07:05 +00005{
6 git config -f /var/gerrit/etc/gerrit.config --unset-all auth.trustedOpenID || true
7 git config -f /var/gerrit/etc/gerrit.config --add auth.trustedOpenID https://
8 git config -f /var/gerrit/etc/gerrit.config --add auth.trustedOpenID imported:
9}
10
Nico Huber54073102023-06-25 11:36:59 +000011if [ "${GITHUB_OAUTH_CLIENT_ID}" -a "${GITHUB_OAUTH_CLIENT_SECRET}" ]; then
12 git config -f /var/gerrit/etc/gerrit.config \
13 plugin.gerrit-oauth-provider-github-oauth.root-url "https://github.com/"
14 git config -f /var/gerrit/etc/gerrit.config \
15 plugin.gerrit-oauth-provider-github-oauth.client-id "${GITHUB_OAUTH_CLIENT_ID}"
16 git config -f /var/gerrit/etc/gerrit.config \
17 plugin.gerrit-oauth-provider-github-oauth.client-secret "${GITHUB_OAUTH_CLIENT_SECRET}"
Nico Huberd9d54fe2023-07-21 04:07:05 +000018 git config -f /var/gerrit/etc/gerrit.config --add auth.trustedOpenID github-oauth:
Nico Huber54073102023-06-25 11:36:59 +000019fi
20
Nico Huberb650ed42023-07-20 17:08:54 +000021secret=/var/gerrit/passwd/secret
22
23{
24 if [ ! -f ${secret} ]; then
25 echo $(mktemp -u XXXXXXXXXXXXXXXX) >${secret}
26 fi
27 chmod 400 ${secret}
28}
29
30if [ "${GERRIT_USER_EMAIL}" ]; then
31 passwd=$(cat ${secret})
32
33 git config -f /etc/gerrit/gerrit.config user.email ${GERRIT_USER_EMAIL}
34 git config -f /etc/gerrit/gerrit.config sendemail.smtpServer mail.${SA_PUBLIC_DOMAIN_NAME}
35 git config -f /etc/gerrit/gerrit.config sendemail.smtpServerPort 465
36 git config -f /etc/gerrit/gerrit.config sendemail.smtpEncryption ssl
37 git config -f /etc/gerrit/gerrit.config sendemail.smtpUser ${GERRIT_USER_EMAIL}
38 git config -f /etc/gerrit/gerrit.config sendemail.smtpPass ${passwd}
39 git config -f /etc/gerrit/gerrit.config sendemail.html false
40fi
41
Nico Hubera1a296f2023-06-25 10:07:07 +000042exec /entrypoint.sh "$@"