You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

docker-setup.sh 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # Prepare git folder
  3. mkdir -p ${HOME} && chmod 0700 ${HOME}
  4. if [ ! -w ${HOME} ]; then echo "${HOME} is not writable"; exit 1; fi
  5. # Prepare custom folder
  6. mkdir -p ${GITEA_CUSTOM} && chmod 0500 ${GITEA_CUSTOM}
  7. # Prepare temp folder
  8. mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP}
  9. if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi
  10. #Prepare config file
  11. if [ ! -f ${GITEA_APP_INI} ]; then
  12. #Prepare config file folder
  13. GITEA_APP_INI_DIR=$(dirname ${GITEA_APP_INI})
  14. mkdir -p ${GITEA_APP_INI_DIR} && chmod 0700 ${GITEA_APP_INI_DIR}
  15. if [ ! -w ${GITEA_APP_INI_DIR} ]; then echo "${GITEA_APP_INI_DIR} is not writable"; exit 1; fi
  16. # Set INSTALL_LOCK to true only if SECRET_KEY is not empty and
  17. # INSTALL_LOCK is empty
  18. if [ -n "$SECRET_KEY" ] && [ -z "$INSTALL_LOCK" ]; then
  19. INSTALL_LOCK=true
  20. fi
  21. # Substitude the environment variables in the template
  22. APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \
  23. RUN_MODE=${RUN_MODE:-"dev"} \
  24. RUN_USER=${USER:-"git"} \
  25. SSH_DOMAIN=${SSH_DOMAIN:-"localhost"} \
  26. HTTP_PORT=${HTTP_PORT:-"3000"} \
  27. ROOT_URL=${ROOT_URL:-""} \
  28. DISABLE_SSH=${DISABLE_SSH:-"false"} \
  29. SSH_PORT=${SSH_PORT:-"2222"} \
  30. SSH_LISTEN_PORT=${SSH_LISTEN_PORT:-$SSH_PORT} \
  31. DB_TYPE=${DB_TYPE:-"sqlite3"} \
  32. DB_HOST=${DB_HOST:-"localhost:3306"} \
  33. DB_NAME=${DB_NAME:-"gitea"} \
  34. DB_USER=${DB_USER:-"root"} \
  35. DB_PASSWD=${DB_PASSWD:-""} \
  36. INSTALL_LOCK=${INSTALL_LOCK:-"false"} \
  37. DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-"false"} \
  38. REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-"false"} \
  39. SECRET_KEY=${SECRET_KEY:-""} \
  40. envsubst < /etc/templates/app.ini > ${GITEA_APP_INI}
  41. fi