4
0
Fork 2
mirror of https://gerrit.hackerspace.pl/hscloud synced 2024-10-18 05:07:46 +00:00
hscloud/app/codehosting/entrypoint.sh
Piotr Dobrowolski 3a3b425ddf app/codehosting: forgejo deployment
Change-Id: Icfe6e0b17932a3248e1bdb807f431c59c48430de
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1685
Reviewed-by: q3k <q3k@hackerspace.pl>
2024-01-30 21:16:33 +00:00

69 lines
2.3 KiB
Bash

#!/bin/bash
for FOLDER in /data/gitea/log /data/git /data/ssh; do
mkdir -p ${FOLDER}
done
if [ ! -d /data/git/.ssh ]; then
mkdir -p /data/git/.ssh
fi
if [ ! -f /data/git/.ssh/environment ]; then
echo "GITEA_CUSTOM=$GITEA_CUSTOM" >| /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 ${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
if [ -n "$SECRET_KEY" ] && [ -z "$INSTALL_LOCK" ]; then
INSTALL_LOCK=true
fi
# Substitude the environment variables in the template
env -i \
APP_NAME="${APP_NAME:-"Gitea: Git with a cup of tea"}" \
RUN_MODE="${RUN_MODE:-"dev"}" \
DOMAIN="${DOMAIN:-"localhost"}" \
SSH_DOMAIN="${SSH_DOMAIN:-"localhost"}" \
HTTP_PORT="${HTTP_PORT:-"3000"}" \
ROOT_URL="${ROOT_URL:-""}" \
DISABLE_SSH="${DISABLE_SSH:-"false"}" \
SSH_PORT="${SSH_PORT:-"22"}" \
SSH_LISTEN_PORT="${SSH_LISTEN_PORT:-"${SSH_PORT}"}" \
LFS_START_SERVER="${LFS_START_SERVER:-"false"}" \
DB_TYPE="${DB_TYPE:-"sqlite3"}" \
DB_HOST="${DB_HOST:-"localhost:3306"}" \
DB_NAME="${DB_NAME:-"gitea"}" \
DB_USER="${DB_USER:-"root"}" \
DB_PASSWD="${DB_PASSWD:-""}" \
INSTALL_LOCK="${INSTALL_LOCK:-"false"}" \
DISABLE_REGISTRATION="${DISABLE_REGISTRATION:-"false"}" \
REQUIRE_SIGNIN_VIEW="${REQUIRE_SIGNIN_VIEW:-"false"}" \
SECRET_KEY="${SECRET_KEY:-""}" \
ALLOW_ONLY_EXTERNAL_REGISTRATION="${ALLOW_ONLY_EXTERNAL_REGISTRATION:-"false"}" \
OFFLINE_MODE="${OFFLINE_MODE:-"true"}" \
MINIO_ENDPOINT="${MINIO_ENDPOINT:-""}" \
MINIO_ACCESS_KEY_ID="${MINIO_ACCESS_KEY_ID:-""}" \
MINIO_SECRET_ACCESS_KEY="${MINIO_SECRET_ACCESS_KEY:-""}" \
MINIO_BUCKET="${MINIO_BUCKET:-""}" \
MAILER_FROM="${MAILER_FROM:-""}" \
MAILER_HOST="${MAILER_HOST:-""}" \
MAILER_PORT="${MAILER_PORT:-""}" \
MAILER_USER="${MAILER_USER:-""}" \
MAILER_PASSWORD="${MAILER_PASSWORD:-""}" \
envsubst < /etc/templates/app.ini > ${GITEA_CUSTOM}/conf/app.ini
cat ${GITEA_CUSTOM}/conf/app.ini
fi
if [ $# -gt 0 ]; then
exec "$@"
else
exec /app/gitea/gitea web
fi