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