summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-05-10 14:30:46 +0100
committerGitHub <noreply@github.com>2020-05-10 16:30:46 +0300
commitf8e015e8e414387b7b319f40e74f2611854d8972 (patch)
tree46f0a29009a2b40f472962e3dc04f6bfa30fe1b8 /modules
parent43bb85908db464036f2ed1e03eb0e8f4e88c84c2 (diff)
downloadgitea-f8e015e8e414387b7b319f40e74f2611854d8972.tar.gz
gitea-f8e015e8e414387b7b319f40e74f2611854d8972.zip
Move LFS directory creation out of NewContext (#11362)
Fix #9481 (probably others too) Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index de0f5cbad2..dd7dbd3fdf 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -749,10 +749,6 @@ func NewContext() {
LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(20 * time.Minute)
if LFS.StartServer {
- if err := os.MkdirAll(LFS.ContentPath, 0700); err != nil {
- log.Fatal("Failed to create '%s': %v", LFS.ContentPath, err)
- }
-
LFS.JWTSecretBytes = make([]byte, 32)
n, err := base64.RawURLEncoding.Decode(LFS.JWTSecretBytes, []byte(LFS.JWTSecretBase64))
@@ -1111,11 +1107,20 @@ func loadOrGenerateInternalToken(sec *ini.Section) string {
return token
}
+func ensureLFSDirectory() {
+ if LFS.StartServer {
+ if err := os.MkdirAll(LFS.ContentPath, 0700); err != nil {
+ log.Fatal("Failed to create '%s': %v", LFS.ContentPath, err)
+ }
+ }
+}
+
// NewServices initializes the services
func NewServices() {
InitDBConfig()
newService()
NewLogServices(false)
+ ensureLFSDirectory()
newCacheService()
newSessionService()
newCORSService()