Skip to content

Commit 36b68fd

Browse files
das7padtechknowlogick
authored andcommitted
[docker] support for custom GITEA_CUSTOM env var (#6608)
1 parent 597ac06 commit 36b68fd

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

docker/root/etc/profile.d/gitea.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

docker/root/etc/s6/gitea/setup

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ if [ ! -d /data/git/.ssh ]; then
66
fi
77

88
if [ ! -f /data/git/.ssh/environment ]; then
9-
echo "GITEA_CUSTOM=/data/gitea" >| /data/git/.ssh/environment
9+
echo "GITEA_CUSTOM=$GITEA_CUSTOM" >| /data/git/.ssh/environment
1010
chmod 600 /data/git/.ssh/environment
11+
12+
elif ! grep -q "^GITEA_CUSTOM=$GITEA_CUSTOM$" /data/git/.ssh/environment; then
13+
sed -i /^GITEA_CUSTOM=/d /data/git/.ssh/environment
14+
echo "GITEA_CUSTOM=$GITEA_CUSTOM" >> /data/git/.ssh/environment
1115
fi
1216

13-
if [ ! -f /data/gitea/conf/app.ini ]; then
14-
mkdir -p /data/gitea/conf
17+
if [ ! -f ${GITEA_CUSTOM}/conf/app.ini ]; then
18+
mkdir -p ${GITEA_CUSTOM}/conf
1519

1620
# Set INSTALL_LOCK to true only if SECRET_KEY is not empty and
1721
# INSTALL_LOCK is empty
@@ -36,7 +40,9 @@ if [ ! -f /data/gitea/conf/app.ini ]; then
3640
DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-"false"} \
3741
REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-"false"} \
3842
SECRET_KEY=${SECRET_KEY:-""} \
39-
envsubst < /etc/templates/app.ini > /data/gitea/conf/app.ini
43+
envsubst < /etc/templates/app.ini > ${GITEA_CUSTOM}/conf/app.ini
44+
45+
chown ${USER}:git ${GITEA_CUSTOM}/conf/app.ini
4046
fi
4147

4248
# only chown if current owner is not already the gitea ${USER}. No recursive check to save time

0 commit comments

Comments
 (0)