gitea command prints incorrect path to config file #9742

Closed
opened 2025-11-02 08:48:10 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @mpeter50 on GitHub (Oct 26, 2022).

Description

According to the documentation, the path of the currently used configuration file can be queried by running the following command:

gitea --help

Application settings can be found in file CustomConf which is by default, $GITEA_CUSTOM/conf/app.ini but may be different if your build has set this differently. Again gitea help will allow you review this variable and you can override it using the --config option on the gitea binary.

As I have observed, the configuration file on my instance is located in /etc/gitea/app.ini.
However, gitea --help shows a different path:

bash-5.1$ gitea --help
NAME:
   Gitea - A painless self-hosted Git service

USAGE:
   gitea [global options] command [command options] [arguments...]

VERSION:
   v1.17.3 built with GNU Make 4.3, go1.18.7 : bindata, timetzdata, sqlite, sqlite_unlock_notify

[...]

DEFAULT CONFIGURATION:
     CustomPath:  /var/lib/gitea/custom (GITEA_CUSTOM)
     CustomConf:  /var/lib/gitea/custom/conf/app.ini
     AppPath:     /usr/local/bin/gitea
     AppWorkPath: /var/lib/gitea

bash-5.1$

The /admin/config also shows the former as the config file:

image

The file indicated by gitea --help exists too, but possibly only because of an earlier misunderstanding of mine. About a year or 2 ago I had a hard time understanding where should I create the config file.
However, modifying this file does not seem to have an effect.

Gitea Version

v1.17.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Raspbian

How are you running Gitea?

In a self-built docker image built from the official Docker.rootless Dockerfile.
No source files or assets are modified, everything should be original.

Database

MySQL

Originally created by @mpeter50 on GitHub (Oct 26, 2022). ### Description According to [the documentation](https://docs.gitea.io/en-us/customizing-gitea/), the path of the currently used configuration file can be queried by running the following command: ``` gitea --help ``` > Application settings can be found in file `CustomConf` which is by default, `$GITEA_CUSTOM/conf/app.ini` but may be different if your build has set this differently. Again `gitea help` will allow you review this variable and you can override it using the `--config` option on the `gitea` binary. As I have observed, the configuration file on my instance is located in `/etc/gitea/app.ini`. However, `gitea --help` shows a different path: ``` bash-5.1$ gitea --help NAME: Gitea - A painless self-hosted Git service USAGE: gitea [global options] command [command options] [arguments...] VERSION: v1.17.3 built with GNU Make 4.3, go1.18.7 : bindata, timetzdata, sqlite, sqlite_unlock_notify [...] DEFAULT CONFIGURATION: CustomPath: /var/lib/gitea/custom (GITEA_CUSTOM) CustomConf: /var/lib/gitea/custom/conf/app.ini AppPath: /usr/local/bin/gitea AppWorkPath: /var/lib/gitea bash-5.1$ ``` The `/admin/config` also shows the former as the config file: ![image](https://user-images.githubusercontent.com/83356418/198068282-df3836bd-7bfd-4cc1-a4dd-8187f5e9c2bf.png) The file indicated by `gitea --help` exists too, but possibly only because of an earlier misunderstanding of mine. About a year or 2 ago I had a hard time understanding where should I create the config file. However, modifying this file does not seem to have an effect. ### Gitea Version v1.17.3 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Raspbian ### How are you running Gitea? In a self-built docker image built from the official Docker.rootless Dockerfile. No source files or assets are modified, everything should be original. ### Database MySQL
GiteaMirror added the type/bug label 2025-11-02 08:48:10 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Oct 26, 2022):

The reason is

https://github.com/go-gitea/gitea/blob/main/docker/rootless/usr/local/bin/gitea

@wxiaoguang commented on GitHub (Oct 26, 2022): The reason is https://github.com/go-gitea/gitea/blob/main/docker/rootless/usr/local/bin/gitea
Author
Owner

@wxiaoguang commented on GitHub (Oct 26, 2022):

Hmm ... it seems to be a bug.

The --help output comes before the parsing of --config.

gitea -c /no-such --help
     CustomConf:  /var/lib/gitea/custom/conf/app.ini
gitea -c /no-such help
     CustomConf:  /no-such

It's nearly unfixable (no clear solution), due to how the "urfave/cli" works and how Gitea uses it (improperly).

@wxiaoguang commented on GitHub (Oct 26, 2022): Hmm ... it seems to be a bug. The `--help` output comes before the parsing of `--config`. ``` gitea -c /no-such --help CustomConf: /var/lib/gitea/custom/conf/app.ini ``` ``` gitea -c /no-such help CustomConf: /no-such ``` It's nearly unfixable (no clear solution), due to how the "urfave/cli" works and how Gitea uses it (improperly).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9742