Skip to content

Commit 0236856

Browse files
pciavaldtechknowlogick
authored andcommitted
migrate database if app.ini found (#5290)
* migrate database if app.ini found * replacing hard-coded user id by env variable * Update per @zeripath's feedback
1 parent cbc14df commit 0236856

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docker/usr/bin/entrypoint

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ if [ "${USER}" != "git" ]; then
77
sed -i -e "s/AllowUsers git$/AllowUsers ${USER}/g" /etc/ssh/sshd_config
88
fi
99

10+
if [ -z "${USER_GID}" ]; then
11+
USER_GID="`id -g ${USER}`"
12+
fi
13+
14+
if [ -z "${USER_UID}" ]; then
15+
USER_UID="`id -u ${USER}`"
16+
fi
17+
1018
## Change GID for USER?
1119
if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
1220
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
@@ -22,6 +30,13 @@ for FOLDER in /data/gitea/conf /data/gitea/log /data/git /data/ssh; do
2230
mkdir -p ${FOLDER}
2331
done
2432

33+
if [ -f /data/gitea/conf/app.ini ]; then
34+
echo "Found app.ini config file, migrating database"
35+
chmod 644 /data/gitea/conf/app.ini
36+
chown -R ${USER_UID}:${USER_GID} /data/git /data/gitea
37+
su - ${USER} -c gitea migrate -c /data/gitea/conf/app.ini
38+
fi
39+
2540
if [ $# -gt 0 ]; then
2641
exec "$@"
2742
else

0 commit comments

Comments
 (0)