File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 33
44package setting
55
6+ import (
7+ "os"
8+ "path/filepath"
9+ )
10+
611// Global settings
712var (
813 // RunUser is the OS user that Gitea is running as. ini:"RUN_USER"
1924 // TempPath is the directory used for temporary files. ini: "TEMP_PATH"
2025 TempPath string
2126)
27+
28+ func init () {
29+ TempPath = filepath .Join (os .TempDir (), "gitea" )
30+ }
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ package setting
77import (
88 "fmt"
99 "os"
10- "path/filepath"
1110 "runtime"
1211 "strings"
1312 "time"
@@ -186,7 +185,10 @@ func loadRunModeFrom(rootCfg ConfigProvider) {
186185
187186func loadTempDir (rootCfg ConfigProvider ) {
188187 rootSec := rootCfg .Section ("" )
189- TempPath = rootSec .Key ("TEMP_PATH" ).MustString (filepath .Join (os .TempDir (), "gitea" ))
188+ tempPath := rootSec .Key ("TEMP_PATH" ).String ()
189+ if tempPath != "" {
190+ TempPath = tempPath
191+ }
190192 if TempPath != "" {
191193 if err := os .MkdirAll (TempPath , os .ModePerm ); err != nil {
192194 log .Fatal ("Failed to create temp directory %s: %v" , TempPath , err )
You can’t perform that action at this time.
0 commit comments