mirror of
https://git.cloudron.io/cloudron/gitea-app.git
synced 2024-11-21 15:41:01 +00:00
Using crudini for configuration merging
This commit is contained in:
parent
b8b3abfbfc
commit
355ee698dc
3 changed files with 62 additions and 19 deletions
|
@ -6,7 +6,7 @@ If you want to disable Cloudron SSO, do the following:
|
|||
* Admin Panel -> Authentication -> 'cloudron' -> Uncheck 'This authentication is activated'
|
||||
* Admin Panel -> Users -> Change Authentication Source to 'Local' and also give a password
|
||||
|
||||
You can create a `/app/data/app.ini` with any custom configuration. See the
|
||||
You can edit `/app/data/app.ini` and add any custom configuration. See the
|
||||
[configuration cheat sheet](https://docs.gitea.io/en-us/config-cheat-sheet)
|
||||
for more information.
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@ APP_NAME = Gitea
|
|||
RUN_USER = git
|
||||
RUN_MODE = prod
|
||||
|
||||
|
||||
[database]
|
||||
; those settings are protected and can't be modified
|
||||
DB_TYPE = mysql
|
||||
HOST = ##MYSQL_HOST:##MYSQL_PORT
|
||||
NAME = ##MYSQL_DATABASE
|
||||
|
@ -11,7 +13,9 @@ PASSWD = ##MYSQL_PASSWORD
|
|||
SSL_MODE = disable
|
||||
PATH =
|
||||
|
||||
|
||||
[server]
|
||||
; those settings are protected and can't be modified
|
||||
PROTOCOL = http
|
||||
DOMAIN = ##DOMAIN
|
||||
ROOT_URL = https://%(DOMAIN)s/
|
||||
|
@ -20,55 +24,74 @@ HTTP_PORT = 3000
|
|||
DISABLE_SSH = ##DISABLE_SSH
|
||||
SSH_PORT = ##SSH_PORT
|
||||
APP_DATA_PATH = /app/data/appdata
|
||||
|
||||
; Landing page for non-logged users, can be "home" or "explore"
|
||||
LANDING_PAGE = explore
|
||||
|
||||
|
||||
[repository]
|
||||
; this setting is protected and can't be modified
|
||||
ROOT = /app/data/repository
|
||||
|
||||
SCRIPT_TYPE = bash
|
||||
|
||||
|
||||
[repository.upload]
|
||||
ENABLED = true
|
||||
|
||||
; this setting is protected and can't be modified
|
||||
TEMP_PATH = /run/gitea/tmp/uploads
|
||||
|
||||
|
||||
[release.attachment]
|
||||
ENABLED = true
|
||||
; APP_DATA_PATH/attachments
|
||||
PATH =
|
||||
|
||||
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
|
||||
; those settings are protected and can't be modified
|
||||
HOST = ##MAIL_SERVER:##MAIL_PORT
|
||||
USER = ##MAIL_SMTP_USERNAME
|
||||
PASSWD = ##MAIL_SMTP_PASSWORD
|
||||
FROM = ##MAIL_FROM
|
||||
SKIP_VERIFY = true
|
||||
|
||||
|
||||
[security]
|
||||
; those settings are protected and can't be modified
|
||||
INSTALL_LOCK = true
|
||||
SECRET_KEY = ##SECRET_KEY
|
||||
|
||||
|
||||
[service]
|
||||
DISABLE_REGISTRATION = false
|
||||
SHOW_REGISTRATION_BUTTON = false
|
||||
ENABLE_NOTIFY_MAIL = true
|
||||
|
||||
|
||||
[log]
|
||||
; Either "console", "file", "conn", "smtp" or "database", default is "console"
|
||||
; those settings are protected and can't be modified
|
||||
MODE = console
|
||||
; used for xorm.log
|
||||
ROOT_PATH = /run/gitea
|
||||
|
||||
|
||||
[picture]
|
||||
; APP_DATA_PATH/avatars
|
||||
AVATAR_UPLOAD_PATH =
|
||||
GRAVATAR_SOURCE = gravatar
|
||||
DISABLE_GRAVATAR = false
|
||||
|
||||
|
||||
[attachment]
|
||||
ENABLE = true
|
||||
; APP_DATA_PATH/attachments
|
||||
PATH =
|
||||
|
||||
|
||||
[indexer]
|
||||
; this setting is protected and can't be modified
|
||||
ISSUE_INDEXER_PATH = /app/data/appdata/indexers/issues.bleve
|
||||
|
|
54
start.sh
54
start.sh
|
@ -55,24 +55,44 @@ sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
|||
-e "s,^HostKey /etc/ssh/,HostKey /app/data/sshd/," \
|
||||
/etc/ssh/sshd_config > /run/gitea/sshd_config
|
||||
|
||||
sed -e "s/##DOMAIN/${APP_DOMAIN}/g" \
|
||||
-e "s/##SSH_PORT/${SSH_PORT}/g" \
|
||||
-e "s/##DISABLE_SSH/${disable_ssh}/g" \
|
||||
-e "s/##MYSQL_HOST/${MYSQL_HOST}/g" \
|
||||
-e "s/##MYSQL_PORT/${MYSQL_PORT}/g" \
|
||||
-e "s/##MYSQL_USERNAME/${MYSQL_USERNAME}/g" \
|
||||
-e "s/##MYSQL_PASSWORD/${MYSQL_PASSWORD}/g" \
|
||||
-e "s/##MYSQL_DATABASE/${MYSQL_DATABASE}/g" \
|
||||
-e "s/##MAIL_SERVER/${MAIL_SMTP_SERVER}/g" \
|
||||
-e "s/##MAIL_PORT/${MAIL_SMTP_PORT}/g" \
|
||||
-e "s/##MAIL_FROM/${MAIL_FROM}/g" \
|
||||
-e "s/##MAIL_SMTP_USERNAME/${MAIL_SMTP_USERNAME}/g" \
|
||||
-e "s/##MAIL_SMTP_PASSWORD/${MAIL_SMTP_PASSWORD}/g" \
|
||||
-e "s/##SECRET_KEY/$(pwgen -1 -s)/g" \
|
||||
/home/git/app.ini.template > "/run/gitea/app.ini"
|
||||
cp /home/git/app.ini.template "/run/gitea/app.ini"
|
||||
|
||||
# create default user config file
|
||||
if ! [ -f /app/data/app.ini ]; then
|
||||
cp /home/git/app.ini.template /app/data/app.ini
|
||||
fi
|
||||
|
||||
# merge user config file
|
||||
crudini --merge "/run/gitea/app.ini" < "/app/data/app.ini"
|
||||
|
||||
# override important values
|
||||
crudini --set "/run/gitea/app.ini" database DB_TYPE mysql
|
||||
crudini --set "/run/gitea/app.ini" database HOST "${MYSQL_HOST}:${MYSQL_PORT}"
|
||||
crudini --set "/run/gitea/app.ini" database NAME "${MYSQL_DATABASE}"
|
||||
crudini --set "/run/gitea/app.ini" database USER "${MYSQL_USERNAME}"
|
||||
crudini --set "/run/gitea/app.ini" database PASSWD "${MYSQL_PASSWORD}"
|
||||
crudini --set "/run/gitea/app.ini" database SSL_MODE "disable"
|
||||
crudini --set "/run/gitea/app.ini" server PROTOCOL "http"
|
||||
crudini --set "/run/gitea/app.ini" server DOMAIN "${APP_DOMAIN}"
|
||||
crudini --set "/run/gitea/app.ini" server ROOT_URL "https://%(DOMAIN)s/"
|
||||
crudini --set "/run/gitea/app.ini" server HTTP_ADDR ""
|
||||
crudini --set "/run/gitea/app.ini" server HTTP_PORT "3000"
|
||||
crudini --set "/run/gitea/app.ini" server DISABLE_SSH "${disable_ssh}"
|
||||
crudini --set "/run/gitea/app.ini" server SSH_PORT "${SSH_PORT}"
|
||||
crudini --set "/run/gitea/app.ini" server APP_DATA_PATH "/app/data/appdata"
|
||||
crudini --set "/run/gitea/app.ini" repository ROOT "/app/data/repository"
|
||||
crudini --set "/run/gitea/app.ini" repository.upload TEMP_PATH "/run/gitea/tmp/uploads"
|
||||
crudini --set "/run/gitea/app.ini" mailer HOST "${MAIL_SMTP_SERVER}:${MAIL_SMTP_PORT}"
|
||||
crudini --set "/run/gitea/app.ini" mailer USER "${MAIL_SMTP_USERNAME}"
|
||||
crudini --set "/run/gitea/app.ini" mailer PASSWD "${MAIL_SMTP_PASSWORD}"
|
||||
crudini --set "/run/gitea/app.ini" mailer FROM "${MAIL_FROM}"
|
||||
crudini --set "/run/gitea/app.ini" mailer SKIP_VERIFY "true"
|
||||
crudini --set "/run/gitea/app.ini" security SECRET_KEY $(pwgen -1 -s)
|
||||
crudini --set "/run/gitea/app.ini" security INSTALL_LOCK "true"
|
||||
crudini --set "/run/gitea/app.ini" log MODE "console"
|
||||
crudini --set "/run/gitea/app.ini" log ROOT_PATH "/run/gitea"
|
||||
crudini --set "/run/gitea/app.ini" indexer ISSUE_INDEXER_PATH "/app/data/appdata/indexers/issues.bleve"
|
||||
|
||||
# merge any user config file
|
||||
[[ -f /app/data/app.ini ]] && cat "/app/data/app.ini" >> "/run/gitea/app.ini"
|
||||
|
||||
mkdir -p /app/data/repository /app/data/ssh
|
||||
|
||||
|
|
Loading…
Reference in a new issue