forked from cloudron-apps/gitea-app
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 -> Authentication -> 'cloudron' -> Uncheck 'This authentication is activated'
|
||||||
* Admin Panel -> Users -> Change Authentication Source to 'Local' and also give a password
|
* 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)
|
[configuration cheat sheet](https://docs.gitea.io/en-us/config-cheat-sheet)
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,9 @@ APP_NAME = Gitea
|
||||||
RUN_USER = git
|
RUN_USER = git
|
||||||
RUN_MODE = prod
|
RUN_MODE = prod
|
||||||
|
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
|
; those settings are protected and can't be modified
|
||||||
DB_TYPE = mysql
|
DB_TYPE = mysql
|
||||||
HOST = ##MYSQL_HOST:##MYSQL_PORT
|
HOST = ##MYSQL_HOST:##MYSQL_PORT
|
||||||
NAME = ##MYSQL_DATABASE
|
NAME = ##MYSQL_DATABASE
|
||||||
|
@ -11,7 +13,9 @@ PASSWD = ##MYSQL_PASSWORD
|
||||||
SSL_MODE = disable
|
SSL_MODE = disable
|
||||||
PATH =
|
PATH =
|
||||||
|
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
|
; those settings are protected and can't be modified
|
||||||
PROTOCOL = http
|
PROTOCOL = http
|
||||||
DOMAIN = ##DOMAIN
|
DOMAIN = ##DOMAIN
|
||||||
ROOT_URL = https://%(DOMAIN)s/
|
ROOT_URL = https://%(DOMAIN)s/
|
||||||
|
@ -20,55 +24,74 @@ HTTP_PORT = 3000
|
||||||
DISABLE_SSH = ##DISABLE_SSH
|
DISABLE_SSH = ##DISABLE_SSH
|
||||||
SSH_PORT = ##SSH_PORT
|
SSH_PORT = ##SSH_PORT
|
||||||
APP_DATA_PATH = /app/data/appdata
|
APP_DATA_PATH = /app/data/appdata
|
||||||
|
|
||||||
; Landing page for non-logged users, can be "home" or "explore"
|
; Landing page for non-logged users, can be "home" or "explore"
|
||||||
LANDING_PAGE = explore
|
LANDING_PAGE = explore
|
||||||
|
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
|
; this setting is protected and can't be modified
|
||||||
ROOT = /app/data/repository
|
ROOT = /app/data/repository
|
||||||
|
|
||||||
SCRIPT_TYPE = bash
|
SCRIPT_TYPE = bash
|
||||||
|
|
||||||
|
|
||||||
[repository.upload]
|
[repository.upload]
|
||||||
ENABLED = true
|
ENABLED = true
|
||||||
|
|
||||||
|
; this setting is protected and can't be modified
|
||||||
TEMP_PATH = /run/gitea/tmp/uploads
|
TEMP_PATH = /run/gitea/tmp/uploads
|
||||||
|
|
||||||
|
|
||||||
[release.attachment]
|
[release.attachment]
|
||||||
ENABLED = true
|
ENABLED = true
|
||||||
; APP_DATA_PATH/attachments
|
; APP_DATA_PATH/attachments
|
||||||
PATH =
|
PATH =
|
||||||
|
|
||||||
|
|
||||||
[mailer]
|
[mailer]
|
||||||
ENABLED = true
|
ENABLED = true
|
||||||
|
|
||||||
|
; those settings are protected and can't be modified
|
||||||
HOST = ##MAIL_SERVER:##MAIL_PORT
|
HOST = ##MAIL_SERVER:##MAIL_PORT
|
||||||
USER = ##MAIL_SMTP_USERNAME
|
USER = ##MAIL_SMTP_USERNAME
|
||||||
PASSWD = ##MAIL_SMTP_PASSWORD
|
PASSWD = ##MAIL_SMTP_PASSWORD
|
||||||
FROM = ##MAIL_FROM
|
FROM = ##MAIL_FROM
|
||||||
SKIP_VERIFY = true
|
SKIP_VERIFY = true
|
||||||
|
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
|
; those settings are protected and can't be modified
|
||||||
INSTALL_LOCK = true
|
INSTALL_LOCK = true
|
||||||
SECRET_KEY = ##SECRET_KEY
|
SECRET_KEY = ##SECRET_KEY
|
||||||
|
|
||||||
|
|
||||||
[service]
|
[service]
|
||||||
DISABLE_REGISTRATION = false
|
DISABLE_REGISTRATION = false
|
||||||
SHOW_REGISTRATION_BUTTON = false
|
SHOW_REGISTRATION_BUTTON = false
|
||||||
ENABLE_NOTIFY_MAIL = true
|
ENABLE_NOTIFY_MAIL = true
|
||||||
|
|
||||||
|
|
||||||
[log]
|
[log]
|
||||||
; Either "console", "file", "conn", "smtp" or "database", default is "console"
|
; those settings are protected and can't be modified
|
||||||
MODE = console
|
MODE = console
|
||||||
; used for xorm.log
|
; used for xorm.log
|
||||||
ROOT_PATH = /run/gitea
|
ROOT_PATH = /run/gitea
|
||||||
|
|
||||||
|
|
||||||
[picture]
|
[picture]
|
||||||
; APP_DATA_PATH/avatars
|
; APP_DATA_PATH/avatars
|
||||||
AVATAR_UPLOAD_PATH =
|
AVATAR_UPLOAD_PATH =
|
||||||
GRAVATAR_SOURCE = gravatar
|
GRAVATAR_SOURCE = gravatar
|
||||||
DISABLE_GRAVATAR = false
|
DISABLE_GRAVATAR = false
|
||||||
|
|
||||||
|
|
||||||
[attachment]
|
[attachment]
|
||||||
ENABLE = true
|
ENABLE = true
|
||||||
; APP_DATA_PATH/attachments
|
; APP_DATA_PATH/attachments
|
||||||
PATH =
|
PATH =
|
||||||
|
|
||||||
|
|
||||||
[indexer]
|
[indexer]
|
||||||
|
; this setting is protected and can't be modified
|
||||||
ISSUE_INDEXER_PATH = /app/data/appdata/indexers/issues.bleve
|
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/," \
|
-e "s,^HostKey /etc/ssh/,HostKey /app/data/sshd/," \
|
||||||
/etc/ssh/sshd_config > /run/gitea/sshd_config
|
/etc/ssh/sshd_config > /run/gitea/sshd_config
|
||||||
|
|
||||||
sed -e "s/##DOMAIN/${APP_DOMAIN}/g" \
|
cp /home/git/app.ini.template "/run/gitea/app.ini"
|
||||||
-e "s/##SSH_PORT/${SSH_PORT}/g" \
|
|
||||||
-e "s/##DISABLE_SSH/${disable_ssh}/g" \
|
# create default user config file
|
||||||
-e "s/##MYSQL_HOST/${MYSQL_HOST}/g" \
|
if ! [ -f /app/data/app.ini ]; then
|
||||||
-e "s/##MYSQL_PORT/${MYSQL_PORT}/g" \
|
cp /home/git/app.ini.template /app/data/app.ini
|
||||||
-e "s/##MYSQL_USERNAME/${MYSQL_USERNAME}/g" \
|
fi
|
||||||
-e "s/##MYSQL_PASSWORD/${MYSQL_PASSWORD}/g" \
|
|
||||||
-e "s/##MYSQL_DATABASE/${MYSQL_DATABASE}/g" \
|
# merge user config file
|
||||||
-e "s/##MAIL_SERVER/${MAIL_SMTP_SERVER}/g" \
|
crudini --merge "/run/gitea/app.ini" < "/app/data/app.ini"
|
||||||
-e "s/##MAIL_PORT/${MAIL_SMTP_PORT}/g" \
|
|
||||||
-e "s/##MAIL_FROM/${MAIL_FROM}/g" \
|
# override important values
|
||||||
-e "s/##MAIL_SMTP_USERNAME/${MAIL_SMTP_USERNAME}/g" \
|
crudini --set "/run/gitea/app.ini" database DB_TYPE mysql
|
||||||
-e "s/##MAIL_SMTP_PASSWORD/${MAIL_SMTP_PASSWORD}/g" \
|
crudini --set "/run/gitea/app.ini" database HOST "${MYSQL_HOST}:${MYSQL_PORT}"
|
||||||
-e "s/##SECRET_KEY/$(pwgen -1 -s)/g" \
|
crudini --set "/run/gitea/app.ini" database NAME "${MYSQL_DATABASE}"
|
||||||
/home/git/app.ini.template > "/run/gitea/app.ini"
|
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
|
mkdir -p /app/data/repository /app/data/ssh
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue