fix: honor DATABASE_URL for the SQLite database location

The variable was defined and documented but never read; the database
path was hardcoded to <cwd>/data/gitea-mirror.db. It now accepts
sqlite://, the legacy file: scheme, or a plain path, with relative
paths resolving against the working directory and the parent directory
created on demand. Defaults are unchanged, including the compose files
that pass the historical default value through. Docs updated to match.
This commit is contained in:
Arunavo Ray committed 2026-08-03 11:59:44 +05:30
1 parent 5c49191d61
commit edf9c14be0
3 files changed
+24 -7

No files matched your search

+1 -1
View File
@@ -108,7 +108,7 @@ These are the ones that matter for nearly every deployment. The [environment var
| `BASE_URL` | `/` | Path prefix when the app is served under a subpath, for example `/mirror`. |
| `DATABASE_URL` | `sqlite://data/gitea-mirror.db` | SQLite database location. The container image sets `file:data/gitea-mirror.db`. |
> **Note:** The database file is always created at `data/gitea-mirror.db` relative to the process working directory, and the directory is created if it is missing. `DATABASE_URL` is accepted and reported but the SQLite driver does not currently resolve an alternative path from it. To relocate the database, mount or symlink the `data` directory rather than changing this variable.
> **Note:** `DATABASE_URL` accepts the `sqlite://` scheme, the legacy `file:` scheme, or a plain path. Relative paths resolve against the process working directory and the parent directory is created if it is missing. Point it at a mounted volume to relocate the database.
### Authentication and secrets
+1 -1
View File
@@ -30,7 +30,7 @@ Variables fall into two groups.
| `BASE_URL` | `/` | Path prefix for subpath deployments, for example `/mirror`. Applied at runtime, so one prebuilt image works under any prefix. |
| `DATABASE_URL` | `sqlite://data/gitea-mirror.db` | SQLite database location. The container image sets `file:data/gitea-mirror.db`. |
> **Note:** The SQLite file is always created at `data/gitea-mirror.db` relative to the process working directory, and the `data` directory is created if missing. `DATABASE_URL` is accepted but the driver does not currently resolve an alternative path from it. Relocate the database by mounting or symlinking the `data` directory.
> **Note:** `DATABASE_URL` accepts the `sqlite://` scheme, the legacy `file:` scheme, or a plain path. Relative paths resolve against the process working directory and the parent directory is created if it is missing. Point it at a mounted volume to relocate the database.
## Authentication and secrets