Skip to content

Commit 6187ce0

Browse files
committed
some improvements
1 parent 058edb9 commit 6187ce0

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

custom/conf/app.example.ini

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ RUN_USER = ; git
5454
;WORK_PATH =
5555

5656
;; The temporary directory, defaults to a directory named gitea under the system temporary directory
57+
;; All other temporary directories are relative to this directory by default
5758
;TEMP_PATH =
5859

5960
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1075,8 +1076,8 @@ LEVEL = Info
10751076
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10761077
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10771078
;;
1078-
;; Path for local repository copy. Defaults to `tmp/local-repo` (content gets deleted on gitea restart)
1079-
;LOCAL_COPY_PATH = tmp/local-repo
1079+
;; Path for local repository copy. Defaults to `local-repo` under `TEMP_PATH` except it's an absolute path (content gets deleted on gitea restart)
1080+
;LOCAL_COPY_PATH = local-repo
10801081

10811082
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10821083
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1087,8 +1088,8 @@ LEVEL = Info
10871088
;; Whether repository file uploads are enabled. Defaults to `true`
10881089
;ENABLED = true
10891090
;;
1090-
;; Path for uploads. Defaults to `data/tmp/uploads` (content gets deleted on gitea restart)
1091-
;TEMP_PATH = data/tmp/uploads
1091+
;; Path for uploads. Defaults to `uploads` under `TEMP_PATH` except it's an absolute path (content gets deleted on gitea restart)
1092+
;TEMP_PATH = uploads
10921093
;;
10931094
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
10941095
;ALLOWED_TYPES =
@@ -2588,8 +2589,8 @@ LEVEL = Info
25882589
;; Currently, only `minio` and `azureblob` is supported.
25892590
;SERVE_DIRECT = false
25902591
;;
2591-
;; Path for chunked uploads. Defaults to APP_DATA_PATH + `tmp/package-upload`
2592-
;CHUNKED_UPLOAD_PATH = tmp/package-upload
2592+
;; Path for chunked uploads. Defaults to `package-upload` under `TEMP_PATH` except it's an absolute path.
2593+
;CHUNKED_UPLOAD_PATH = package-upload
25932594
;;
25942595
;; Maximum count of package versions a single owner can have (`-1` means no limits)
25952596
;LIMIT_TOTAL_OWNER_COUNT = -1

modules/setting/packages.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ func loadPackagesFrom(rootCfg ConfigProvider) (err error) {
6767
return err
6868
}
6969

70-
Packages.ChunkedUploadPath = filepath.ToSlash(sec.Key("CHUNKED_UPLOAD_PATH").MustString("tmp/package-upload"))
70+
Packages.ChunkedUploadPath = filepath.ToSlash(sec.Key("CHUNKED_UPLOAD_PATH").MustString("package-upload"))
7171
if !filepath.IsAbs(Packages.ChunkedUploadPath) {
72-
Packages.ChunkedUploadPath = filepath.ToSlash(filepath.Join(AppDataPath, Packages.ChunkedUploadPath))
72+
Packages.ChunkedUploadPath = filepath.Join(TempPath, Packages.ChunkedUploadPath)
7373
}
7474

7575
if HasInstallLock(rootCfg) {

modules/setting/repository.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ var (
187187
MaxFiles int
188188
}{
189189
Enabled: true,
190-
TempPath: "data/tmp/uploads",
190+
TempPath: "uploads",
191191
AllowedTypes: "",
192192
FileMaxSize: 50,
193193
MaxFiles: 5,
@@ -197,7 +197,7 @@ var (
197197
Local: struct {
198198
LocalCopyPath string
199199
}{
200-
LocalCopyPath: "tmp/local-repo",
200+
LocalCopyPath: "local-repo",
201201
},
202202

203203
// Pull request settings
@@ -361,8 +361,10 @@ func loadRepositoryFrom(rootCfg ConfigProvider) {
361361
}
362362
}
363363

364-
if !filepath.IsAbs(Repository.Upload.TempPath) {
365-
Repository.Upload.TempPath = filepath.Join(AppWorkPath, Repository.Upload.TempPath)
364+
if Repository.Upload.TempPath == "" {
365+
Repository.Upload.TempPath = filepath.Join(TempPath, "uploads")
366+
} else if !filepath.IsAbs(Repository.Upload.TempPath) {
367+
Repository.Upload.TempPath = filepath.Join(TempPath, Repository.Upload.TempPath)
366368
}
367369

368370
if err := loadRepoArchiveFrom(rootCfg); err != nil {

modules/setting/ssh.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ func loadSSHFrom(rootCfg ConfigProvider) {
122122
if len(serverMACs) > 0 {
123123
SSH.ServerMACs = serverMACs
124124
}
125-
SSH.KeyTestPath = TempPath
125+
SSH.KeyTestPath = sec.Key("SSH_KEY_TEST_PATH").MustString("ssh_key_test")
126+
if !filepath.IsAbs(SSH.KeyTestPath) {
127+
SSH.KeyTestPath = filepath.Join(TempPath, SSH.KeyTestPath)
128+
}
126129
if err = sec.MapTo(&SSH); err != nil {
127130
log.Fatal("Failed to map SSH settings: %v", err)
128131
}

0 commit comments

Comments
 (0)