mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 14:06:15 +01:00
1a673c0ff6
(cherry picked from commit12d7bc447e
) (cherry picked from commit1335b17fc3
) (cherry picked from commit0d7da06c47
) (cherry picked from commit095c1ab679
) (cherry picked from commit2220f00d09
) (cherry picked from commitf0be8bbdbf
) (cherry picked from commit15188180a1
) (cherry picked from commit96c471d7d3
) (cherry picked from commit709052f1e7
) (cherry picked from commit98cd2f5dee
) (cherry picked from commita1014654b1
) (cherry picked from commita16f4dc51d
) (cherry picked from commitabbed33d16
) (cherry picked from commit4871447def
) (cherry picked from commitea1218b237
) (cherry picked from commit6dd67d60de
) (cherry picked from commit71761f04af
) (cherry picked from commit7cb28a3a06
) (cherry picked from commitd116336cb5
) (cherry picked from commit4138a698b2
) (cherry picked from commit38c572bc19
) (cherry picked from commit94c759b47f
) (cherry picked from commite1f52bf1d5
) (cherry picked from commit8bc7000cfa
) (cherry picked from commitfa60007c34
) (cherry picked from commit0328db39c9
) (cherry picked from commitd028010b64
) (cherry picked from commit0283c920f0
) (cherry picked from commitf5bdf3e11f
) (cherry picked from commite3beb52300
) (cherry picked from commita63d5afc91
) (cherry picked from commit7d43e1a828
) (cherry picked from commita551fbd0fa
) (cherry picked from commitcdff0ddbb6
) (cherry picked from commitf2462ab1d0
) (cherry picked from commit7231dcc0a7
) (cherry picked from commit1cbe55f832
) (cherry picked from commit483d953498
) (cherry picked from commite0b863d2e9
) (cherry picked from commit34dc719b4d
) (cherry picked from commit200f1ddec3
) (cherry picked from commit892435f00f
) (cherry picked from commit188d1d387a
) (cherry picked from commit8589533bfe
) (cherry picked from commit8e7e83ffe5
) (cherry picked from commit4f86171d68
) (cherry picked from commitece61fd4f6
) (cherry picked from commitff34eb0023
) (cherry picked from commit845b0ecc8c
)
51 lines
1.8 KiB
Bash
Executable file
51 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Prepare git folder
|
|
mkdir -p ${HOME} && chmod 0700 ${HOME}
|
|
if [ ! -w ${HOME} ]; then echo "${HOME} is not writable"; exit 1; fi
|
|
|
|
# Prepare custom folder
|
|
mkdir -p ${GITEA_CUSTOM} && chmod 0700 ${GITEA_CUSTOM}
|
|
|
|
# Prepare temp folder
|
|
mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP}
|
|
if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi
|
|
|
|
#Prepare config file
|
|
if [ ! -f ${GITEA_APP_INI} ]; then
|
|
|
|
#Prepare config file folder
|
|
GITEA_APP_INI_DIR=$(dirname ${GITEA_APP_INI})
|
|
mkdir -p ${GITEA_APP_INI_DIR} && chmod 0700 ${GITEA_APP_INI_DIR}
|
|
if [ ! -w ${GITEA_APP_INI_DIR} ]; then echo "${GITEA_APP_INI_DIR} is not writable"; exit 1; fi
|
|
|
|
# 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
|
|
|
|
# Substitute the environment variables in the template
|
|
APP_NAME=${APP_NAME:-"Forgejo: Beyond coding. We forge."} \
|
|
RUN_MODE=${RUN_MODE:-"prod"} \
|
|
RUN_USER=${USER:-"git"} \
|
|
SSH_DOMAIN=${SSH_DOMAIN:-"localhost"} \
|
|
HTTP_PORT=${HTTP_PORT:-"3000"} \
|
|
ROOT_URL=${ROOT_URL:-""} \
|
|
DISABLE_SSH=${DISABLE_SSH:-"false"} \
|
|
SSH_PORT=${SSH_PORT:-"2222"} \
|
|
SSH_LISTEN_PORT=${SSH_LISTEN_PORT:-$SSH_PORT} \
|
|
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:-""} \
|
|
envsubst < /etc/templates/app.ini > ${GITEA_APP_INI}
|
|
fi
|
|
|
|
# Replace app.ini settings with env variables in the form GITEA__SECTION_NAME__KEY_NAME
|
|
environment-to-ini --config ${GITEA_APP_INI}
|