diff --git a/docs/administration/config-cheat-sheet.md b/docs/administration/config-cheat-sheet.md index 35097674..23db55dd 100644 --- a/docs/administration/config-cheat-sheet.md +++ b/docs/administration/config-cheat-sheet.md @@ -34,8 +34,34 @@ A full restart is required for Gitea configuration changes to take effect. ## Use environment variables to setup Gitea -There is [environment-to-ini](https://github.com/go-gitea/gitea/blob/main/docker/root/usr/local/bin/environment-to-ini) to help to -generate Gitea's `app.ini` from environment variables. +Gitea supports setting `app.ini` values via environment variables of the form `GITEA__
__`. These require running `gitea config edit-ini --in-place --apply-env` before starting Gitea to write them into `app.ini`. The official Docker images do this automatically on container startup. + +For example, to configure the database connection via environment variables: + +``` +GITEA__database__DB_TYPE=postgres +GITEA__database__HOST=127.0.0.1:5432 +GITEA__database__NAME=gitea +GITEA__database__USER=gitea +GITEA__database__PASSWD=secret +``` + +This is equivalent to the following `app.ini` configuration: + +```ini +[database] +DB_TYPE = postgres +HOST = 127.0.0.1:5432 +NAME = gitea +USER = gitea +PASSWD = secret +``` + +You can also load values from files by appending `__FILE` to the variable name. This is useful for Docker secrets: + +``` +GITEA__database__PASSWD__FILE=/run/secrets/db_password +``` ## Default Internal Variables (non-`app.ini` configuration) diff --git a/docs/installation/with-docker-rootless.md b/docs/installation/with-docker-rootless.md index 3aa67178..9b0621e8 100644 --- a/docs/installation/with-docker-rootless.md +++ b/docs/installation/with-docker-rootless.md @@ -288,9 +288,8 @@ docker-compose up -d ## Managing Deployments With Environment Variables In addition to the environment variables above, any settings in `app.ini` can be set -or overridden with an environment variable of the form: `GITEA__SECTION_NAME__KEY_NAME`. +or overridden with an environment variable of the form: `GITEA__
__`. These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes. -Full information [here](https://github.com/go-gitea/gitea/tree/main/contrib/environment-to-ini). These environment variables can be passed to the docker container in `docker-compose.yml`. The following example will enable a smtp mail server if the required env variables diff --git a/docs/installation/with-docker.md b/docs/installation/with-docker.md index db312425..b77921db 100644 --- a/docs/installation/with-docker.md +++ b/docs/installation/with-docker.md @@ -277,9 +277,8 @@ docker compose up -d ## Managing Deployments With Environment Variables In addition to the environment variables above, any settings in `app.ini` can be set -or overridden with an environment variable of the form: `GITEA__SECTION_NAME__KEY_NAME`. +or overridden with an environment variable of the form: `GITEA__
__`. These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes. -Full information [here](https://github.com/go-gitea/gitea/tree/master/contrib/environment-to-ini). These environment variables can be passed to the docker container in `docker-compose.yml`. The following example will enable an smtp mail server if the required env variables