aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorJakob Ackermann <das7pad@outlook.com>2019-05-14 00:19:38 +0200
committertechknowlogick <hello@techknowlogick.com>2019-05-13 18:19:37 -0400
commit36b68fdb0187a1db8711f093cdfa6b6b620082b4 (patch)
tree8c97db57a75ee81c1d9a123611bc2abbc4f9f747 /docker
parent597ac064c3cb5931bc98b3dea6d742e08cb9fc11 (diff)
downloadgitea-36b68fdb0187a1db8711f093cdfa6b6b620082b4.tar.gz
gitea-36b68fdb0187a1db8711f093cdfa6b6b620082b4.zip
[docker] support for custom GITEA_CUSTOM env var (#6608)
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/root/etc/profile.d/gitea.sh2
-rwxr-xr-xdocker/root/etc/s6/gitea/setup14
2 files changed, 10 insertions, 6 deletions
diff --git a/docker/root/etc/profile.d/gitea.sh b/docker/root/etc/profile.d/gitea.sh
deleted file mode 100755
index 41afd4cfb8..0000000000
--- a/docker/root/etc/profile.d/gitea.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-export GITEA_CUSTOM=/data/gitea
diff --git a/docker/root/etc/s6/gitea/setup b/docker/root/etc/s6/gitea/setup
index 2b0fb6c37b..dec0ee2b55 100755
--- a/docker/root/etc/s6/gitea/setup
+++ b/docker/root/etc/s6/gitea/setup
@@ -6,12 +6,16 @@ if [ ! -d /data/git/.ssh ]; then
fi
if [ ! -f /data/git/.ssh/environment ]; then
- echo "GITEA_CUSTOM=/data/gitea" >| /data/git/.ssh/environment
+ echo "GITEA_CUSTOM=$GITEA_CUSTOM" >| /data/git/.ssh/environment
chmod 600 /data/git/.ssh/environment
+
+elif ! grep -q "^GITEA_CUSTOM=$GITEA_CUSTOM$" /data/git/.ssh/environment; then
+ sed -i /^GITEA_CUSTOM=/d /data/git/.ssh/environment
+ echo "GITEA_CUSTOM=$GITEA_CUSTOM" >> /data/git/.ssh/environment
fi
-if [ ! -f /data/gitea/conf/app.ini ]; then
- mkdir -p /data/gitea/conf
+if [ ! -f ${GITEA_CUSTOM}/conf/app.ini ]; then
+ mkdir -p ${GITEA_CUSTOM}/conf
# Set INSTALL_LOCK to true only if SECRET_KEY is not empty and
# INSTALL_LOCK is empty
@@ -36,7 +40,9 @@ if [ ! -f /data/gitea/conf/app.ini ]; then
DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-"false"} \
REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-"false"} \
SECRET_KEY=${SECRET_KEY:-""} \
- envsubst < /etc/templates/app.ini > /data/gitea/conf/app.ini
+ envsubst < /etc/templates/app.ini > ${GITEA_CUSTOM}/conf/app.ini
+
+ chown ${USER}:git ${GITEA_CUSTOM}/conf/app.ini
fi
# only chown if current owner is not already the gitea ${USER}. No recursive check to save time