forgejo/docker/rootless/usr/local/bin/docker-setup.sh

52 lines
1.8 KiB
Bash
Raw Normal View History

#!/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
[BRANDING] container images: set APP_NAME (cherry picked from commit 12d7bc447edb272327200389c73bb04bb5fccc14) (cherry picked from commit 1335b17fc35b8b873b94435fddcc23c5cdf0117e) (cherry picked from commit 0d7da06c47ac3a7278602871b95234f823e11f1d) (cherry picked from commit 095c1ab679bce39dbaa89e8a86eaeab8a9b823ad) (cherry picked from commit 2220f00d09e2692d10e0d07f1e8ae2232a636a7d) (cherry picked from commit f0be8bbdbfb758fd13f2f9325358ad292f6c030c) (cherry picked from commit 15188180a15adb58bbde418018612561b68b6927) (cherry picked from commit 96c471d7d36a24824835b254bf785689f898d715) (cherry picked from commit 709052f1e79bbb0ee417f8001c9c0dbd03e78791) (cherry picked from commit 98cd2f5deee05ae9be67250c85fc17e31eaaf28a) (cherry picked from commit a1014654b13e338eaf35cd96d6115fe88459480f) (cherry picked from commit a16f4dc51dce3f9d22cf899186fc61931a82f35e) (cherry picked from commit abbed33d1699daa99620acdec5322846f562cb8d) (cherry picked from commit 4871447def0794027227280059bdfa29cacc0a23) (cherry picked from commit ea1218b237017fa3ca3e5204afd56a18e8336650) (cherry picked from commit 6dd67d60de567e70a36524db940b8e88420251c0) (cherry picked from commit 71761f04afff6d1552c5604fcf7f9b5a27cf01ba) (cherry picked from commit 7cb28a3a06b1b665a6ac9d2687c79ef5ceed0dba) (cherry picked from commit d116336cb5a2df68260fbec42b606fa35c27ba30) (cherry picked from commit 4138a698b2744f504cc6e3590ab8b14753cb719d) (cherry picked from commit 38c572bc1928fc138503a88b66aa8e6d1c06aa6e) (cherry picked from commit 94c759b47f93dde23473d45eff2309dce5055d8a) (cherry picked from commit e1f52bf1d5087df6c7905afc08a7cbada6854f7f) (cherry picked from commit 8bc7000cfa7d0caa87f99c07543f36925fbe984b) (cherry picked from commit fa60007c3464a8d7fc278df1f6d51fb40c6ed130) (cherry picked from commit 0328db39c9a9359046aea0a422002a3072509345) (cherry picked from commit d028010b64e9d12dc3698fadd8b6f017ea2762ef) (cherry picked from commit 0283c920f01e8ec599613f8e28fa39157f698e4c) (cherry picked from commit f5bdf3e11f93c508d03ce38d66550aadeb41abdd) (cherry picked from commit e3beb523007fe87951a4e901596aaef965de0771) (cherry picked from commit a63d5afc91a5c7f29969c5ed722c6718c1452e6d) (cherry picked from commit 7d43e1a828139d20b5baafe1df706e11ed4d83a8) (cherry picked from commit a551fbd0fa00231a886c101d5fe438b184c01b93) (cherry picked from commit cdff0ddbb67237638d60ed5a6180670813ce24d0) (cherry picked from commit e0aadc9f4a04e7e6386ec7b6c0793fecd34059b2) (cherry picked from commit a448c06caf1abd705dc6daca8010a5404c80519e) (cherry picked from commit bd2055bff67e43056934d445bfe060762b3a579f)
2022-12-25 15:25:25 +00:00
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}