Skip to content

Commit 50e1469

Browse files
wxiaoguangGiteaBot
andauthored
Update path related documents (#25417)
Update WorkPath/WORK_PATH related documents, remove out-dated information. Remove "StaticRootPath" on the admin config display page, because few end user really need it, it only causes misconfiguration. ![image](https://github.com/go-gitea/gitea/assets/2114189/8095afa4-da76-436b-9e89-2a92c229c01d) Co-authored-by: Giteabot <[email protected]>
1 parent 06df92b commit 50e1469

File tree

11 files changed

+31
-46
lines changed

11 files changed

+31
-46
lines changed

custom/conf/app.example.ini

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,23 @@
1616
;;
1717
;; - _`AppPath`_: This is the absolute path of the running gitea binary.
1818
;; - _`AppWorkPath`_: This refers to "working path" of the `gitea` binary. It is determined by using the first set thing in the following hierarchy:
19+
;; - The "WORK_PATH" option in "app.ini" file
1920
;; - The `--work-path` flag passed to the binary
2021
;; - The environment variable `$GITEA_WORK_DIR`
2122
;; - A built-in value set at build time (see building from source)
2223
;; - Otherwise it defaults to the directory of the _`AppPath`_
23-
;; - If any of the above are relative paths then they are made absolute against
24-
;; the directory of the _`AppPath`_
25-
;; - _`CustomPath`_: This is the base directory for custom templates and other options.
26-
;; It is determined by using the first set thing in the following hierarchy:
24+
;; - If any of the above are relative paths then they are made absolute against the directory of the _`AppPath`_
25+
;; - _`CustomPath`_: This is the base directory for custom templates and other options. It is determined by using the first set thing in the following hierarchy:
2726
;; - The `--custom-path` flag passed to the binary
2827
;; - The environment variable `$GITEA_CUSTOM`
2928
;; - A built-in value set at build time (see building from source)
3029
;; - Otherwise it defaults to _`AppWorkPath`_`/custom`
31-
;; - If any of the above are relative paths then they are made absolute against the
32-
;; the directory of the _`AppWorkPath`_
30+
;; - If any of the above are relative paths then they are made absolute against the directory of the _`AppWorkPath`_
3331
;; - _`CustomConf`_: This is the path to the `app.ini` file.
3432
;; - The `--config` flag passed to the binary
3533
;; - A built-in value set at build time (see building from source)
3634
;; - Otherwise it defaults to _`CustomPath`_`/conf/app.ini`
37-
;; - If any of the above are relative paths then they are made absolute against the
38-
;; the directory of the _`CustomPath`_
35+
;; - If any of the above are relative paths then they are made absolute against the directory of the _`CustomPath`_
3936
;;
4037
;; In addition there is _`StaticRootPath`_ which can be set as a built-in at build time, but will otherwise default to _`AppWorkPath`_
4138

@@ -52,6 +49,9 @@ RUN_USER = ; git
5249
;; Application run mode, affects performance and debugging: "dev" or "prod", default is "prod"
5350
;; Mode "dev" makes Gitea easier to develop and debug, values other than "dev" are treated as "prod" which is for production use.
5451
;RUN_MODE = prod
52+
;;
53+
;; The working directory, see the comment of AppWorkPath above
54+
;WORK_PATH =
5555

5656
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5757
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/administration/backup-and-restore.en-us.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ directory. There should be some output similar to the following:
4646

4747
Inside the `gitea-dump-1482906742.zip` file, will be the following:
4848

49-
- `app.ini` - Optional copy of configuration file if originally stored outside of the default `custom/` directory
49+
- `app.ini` - Optional copy of configuration file if originally stored outside the default `custom/` directory
5050
- `custom` - All config or customization files in `custom/`.
51-
- `data` - Data directory in <GITEA_WORK_DIR>, except sessions if you are using file session. This directory includes `attachments`, `avatars`, `lfs`, `indexers`, SQLite file if you are using SQLite.
51+
- `data` - Data directory (APP_DATA_PATH), except sessions if you are using file session. This directory includes `attachments`, `avatars`, `lfs`, `indexers`, SQLite file if you are using SQLite.
5252
- `gitea-db.sql` - SQL dump of database
5353
- `gitea-repo.zip` - Complete copy of the repository directory.
5454
- `log/` - Various logs. They are not needed for a recovery or migration.
@@ -139,16 +139,6 @@ chown -R git:git /data
139139

140140
The default user in the gitea container is `git` (1000:1000). Please replace `2a83b293548e` with your gitea container id or name.
141141

142-
These are the default paths used in the container:
143-
144-
```text
145-
DEFAULT CONFIGURATION:
146-
CustomPath: /data/gitea (GITEA_CUSTOM)
147-
CustomConf: /data/gitea/conf/app.ini
148-
AppPath: /usr/local/bin/gitea
149-
AppWorkPath: /usr/local/bin
150-
```
151-
152142
### Using Docker-rootless (`restore`)
153143

154144
The restore workflow in Docker-rootless containers differs only in the directories to be used:

docs/content/doc/administration/command-line.en-us.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ All global options can be placed at the command level.
3131

3232
- `--help`, `-h`: Show help text and exit. Optional.
3333
- `--version`, `-v`: Show version and exit. Optional. (example: `Gitea version 1.1.0+218-g7b907ed built with: bindata, sqlite`).
34-
- `--custom-path path`, `-C path`: Location of the Gitea custom folder. Optional. (default: `AppWorkPath`/custom or `$GITEA_CUSTOM`).
35-
- `--config path`, `-c path`: Gitea configuration file path. Optional. (default: `custom`/conf/app.ini).
36-
- `--work-path path`, `-w path`: Gitea `AppWorkPath`. Optional. (default: LOCATION_OF_GITEA_BINARY or `$GITEA_WORK_DIR`)
34+
- `--work-path path`, `-w path`: Gitea's work path. Optional. (default: the binary's path or `$GITEA_WORK_DIR`)
35+
- `--custom-path path`, `-C path`: Gitea's custom folder path. Optional. (default: `WorkPath`/custom or `$GITEA_CUSTOM`).
36+
- `--config path`, `-c path`: Gitea configuration file path. Optional. (default: `CustomPath`/conf/app.ini).
3737

3838
NB: The defaults custom-path, config and work-path can also be
3939
changed at build time (if preferred).

docs/content/doc/administration/config-cheat-sheet.en-us.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,27 @@ reported as part of the default configuration when running `gitea --help` or on
4444

4545
- _`AppPath`_: This is the absolute path of the running gitea binary.
4646
- _`AppWorkPath`_: This refers to "working path" of the `gitea` binary. It is determined by using the first set thing in the following hierarchy:
47+
- The `WORK_PATH` option in `app.ini`
4748
- The `--work-path` flag passed to the binary
4849
- The environment variable `$GITEA_WORK_DIR`
4950
- A built-in value set at build time (see building from source)
50-
- Otherwise it defaults to the directory of the _`AppPath`_
51-
- If any of the above are relative paths then they are made absolute against
52-
the directory of the _`AppPath`_
51+
- Otherwise, it defaults to the directory of the _`AppPath`_
52+
- If any of the above are relative paths then they are made absolute against the directory of the _`AppPath`_
5353
- _`CustomPath`_: This is the base directory for custom templates and other options.
5454
It is determined by using the first set thing in the following hierarchy:
5555
- The `--custom-path` flag passed to the binary
5656
- The environment variable `$GITEA_CUSTOM`
5757
- A built-in value set at build time (see building from source)
58-
- Otherwise it defaults to _`AppWorkPath`_`/custom`
58+
- Otherwise, it defaults to _`AppWorkPath`_`/custom`
5959
- If any of the above are relative paths then they are made absolute against the
6060
the directory of the _`AppWorkPath`_
6161
- _`CustomConf`_: This is the path to the `app.ini` file.
6262
- The `--config` flag passed to the binary
6363
- A built-in value set at build time (see building from source)
64-
- Otherwise it defaults to _`CustomPath`_`/conf/app.ini`
65-
- If any of the above are relative paths then they are made absolute against the
66-
the directory of the _`CustomPath`_
64+
- Otherwise, it defaults to _`CustomPath`_`/conf/app.ini`
65+
- If any of the above are relative paths then they are made absolute against the directory of the _`CustomPath`_
6766

68-
In addition there is _`StaticRootPath`_ which can be set as a built-in at build time, but will otherwise default to _`AppWorkPath`_
67+
In addition, there is _`StaticRootPath`_ which can be set as a built-in at build time, but will otherwise default to _`AppWorkPath`_
6968

7069
## Overall (`DEFAULT`)
7170

@@ -74,6 +73,7 @@ In addition there is _`StaticRootPath`_ which can be set as a built-in at build
7473
This should be a dedicated system (non-user) account. Setting this incorrectly will cause Gitea
7574
to not start.
7675
- `RUN_MODE`: **prod**: Application run mode, affects performance and debugging: `dev` or `prod`, default is `prod`. Mode `dev` makes Gitea easier to develop and debug, values other than `dev` are treated as `prod` which is for production use.
76+
- `WORK_PATH`: **_the-work-path_**: The working directory, see the comment of AppWorkPath above.
7777

7878
## Repository (`repository`)
7979

docs/content/doc/administration/customizing-gitea.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ menu:
1818
# Customizing Gitea
1919

2020
Customizing Gitea is typically done using the `CustomPath` folder - by default this is
21-
the `custom` folder from the running directory, but may be different if your build has
21+
the `custom` folder from the working directory (WorkPath), but may be different if your build has
2222
set this differently. This is the central place to override configuration settings,
2323
templates, etc. You can check the `CustomPath` using `gitea help`. You can also find
2424
the path on the _Configuration_ tab in the _Site Administration_ page. You can override

docs/content/doc/administration/environment-variables.en-us.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ For documentation about each of the variables available, refer to the
4343
## Gitea files
4444

4545
- `GITEA_WORK_DIR`: Absolute path of working directory.
46-
- `GITEA_CUSTOM`: Gitea uses `GITEA_WORK_DIR`/custom folder by default. Use this variable
47-
to change _custom_ directory.
48-
- `GOGS_WORK_DIR`: Deprecated, use `GITEA_WORK_DIR`
49-
- `GOGS_CUSTOM`: Deprecated, use `GITEA_CUSTOM`
46+
- `GITEA_CUSTOM`: Gitea uses `WorkPath`/custom folder by default. Use this variable to change _custom_ directory.
5047

5148
## Operating system specifics
5249

docs/content/doc/help/faq.en-us.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ https://github.com/loganinak/MigrateGitlabToGogs
5959
## Where does Gitea store what file
6060

6161
- _`AppWorkPath`_
62-
- The `--work-path` flag
62+
- The `WORK_PATH` option in `app.ini`
63+
- Else the `--work-path` flag
6364
- Else Environment variable `GITEA_WORK_DIR`
6465
- Else a built-in value set at build time
6566
- Else the directory that contains the Gitea binary
66-
- `%(APP_DATA_PATH)` (default for database, indexers, etc.)
67+
- `AppDataPath` (default for database, indexers, etc.)
6768
- `APP_DATA_PATH` from `app.ini`
6869
- Else _`AppWorkPath`_`/data`
6970
- _`CustomPath`_ (custom templates)
@@ -112,9 +113,6 @@ Gitea's custom templates must be added to the correct location or Gitea will not
112113
The correct path for the template(s) will be relative to the `CustomPath`
113114

114115
1. To find `CustomPath`, look for Custom File Root Path in Site Administration -> Configuration
115-
116-
If that doesn't exist, you can try `echo $GITEA_CUSTOM`
117-
118116
2. If you are still unable to find a path, the default can be [calculated above](#where-does-gitea-store-what-file)
119117
3. Once you have figured out the correct custom path, you can refer to the [customizing Gitea]({{< relref "doc/administration/customizing-gitea.en-us.md" >}}) page to add your template to the correct location.
120118

modules/setting/path.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
// AppPath represents the path to the gitea binary
1818
AppPath string
1919

20-
// AppWorkPath is the "working directory" of Gitea. It maps to the environment variable GITEA_WORK_DIR.
20+
// AppWorkPath is the "working directory" of Gitea. It maps to the: WORK_PATH in app.ini, "--work-path" flag, environment variable GITEA_WORK_DIR.
2121
// If that is not set it is the default set here by the linker or failing that the directory of AppPath.
2222
// It is used as the base path for several other paths.
2323
AppWorkPath string

options/locale/locale_en-US.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2962,9 +2962,9 @@ config.disable_router_log = Disable Router Log
29622962
config.run_user = Run As Username
29632963
config.run_mode = Run Mode
29642964
config.git_version = Git Version
2965+
config.app_data_path = App Data Path
29652966
config.repo_root_path = Repository Root Path
29662967
config.lfs_root_path = LFS Root Path
2967-
config.static_file_root_path = Static File Root Path
29682968
config.log_file_root_path = Log Path
29692969
config.script_type = Script Type
29702970
config.reverse_auth_user = Reverse Authentication User

routers/web/admin/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ func Config(ctx *context.Context) {
120120
ctx.Data["RunMode"] = util.ToTitleCase(setting.RunMode)
121121
ctx.Data["GitVersion"] = git.VersionInfo()
122122

123+
ctx.Data["AppDataPath"] = setting.AppDataPath
123124
ctx.Data["RepoRootPath"] = setting.RepoRootPath
124125
ctx.Data["CustomRootPath"] = setting.CustomPath
125-
ctx.Data["StaticRootPath"] = setting.StaticRootPath
126126
ctx.Data["LogRootPath"] = setting.Log.RootPath
127127
ctx.Data["ScriptType"] = setting.ScriptType
128128
ctx.Data["ReverseProxyAuthUser"] = setting.ReverseProxyAuthUser

templates/admin/config.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434

3535
<div class="divider"></div>
3636

37+
<dt>{{.locale.Tr "admin.config.app_data_path"}}</dt>
38+
<dd>{{.AppDataPath}}</dd>
3739
<dt>{{.locale.Tr "admin.config.repo_root_path"}}</dt>
3840
<dd>{{.RepoRootPath}}</dd>
39-
<dt>{{.locale.Tr "admin.config.static_file_root_path"}}</dt>
40-
<dd>{{.StaticRootPath}}</dd>
4141
<dt>{{.locale.Tr "admin.config.custom_file_root_path"}}</dt>
4242
<dd>{{.CustomRootPath}}</dd>
4343
<dt>{{.locale.Tr "admin.config.log_file_root_path"}}</dt>

0 commit comments

Comments
 (0)