mirror of
https://gitea.com/gitea/docs.git
synced 2026-06-11 04:31:26 +00:00
Update environment variable docs, remove environment-to-ini references (#355)
The standalone `environment-to-ini` tool was removed in https://github.com/go-gitea/gitea/pull/35735 and its functionality is now built into the Gitea binary. This PR: - Removes outdated links to the removed `contrib/environment-to-ini` directory - Updates the "Use environment variables to setup Gitea" section in the config cheat sheet - Adds examples showing how env vars map to `app.ini` settings and the `__FILE` suffix for secrets *This PR was authored by Claude.* Reviewed-on: https://gitea.com/gitea/docs/pulls/355 Reviewed-by: wxiaoguang <29147+wxiaoguang@noreply.gitea.com> Reviewed-by: TheFox0x7 <95654+thefox0x7@noreply.gitea.com>
This commit is contained in:
@@ -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__<section>__<KEY>`. 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)
|
||||
|
||||
|
||||
@@ -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__<section>__<KEY>`.
|
||||
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
|
||||
|
||||
@@ -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__<section>__<KEY>`.
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user