Skip to content

Commit f8e015e

Browse files
zeripathlafriks
andauthored
Move LFS directory creation out of NewContext (#11362)
Fix #9481 (probably others too) Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: Lauris BH <[email protected]>
1 parent 43bb859 commit f8e015e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

modules/setting/setting.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,10 +749,6 @@ func NewContext() {
749749
LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(20 * time.Minute)
750750

751751
if LFS.StartServer {
752-
if err := os.MkdirAll(LFS.ContentPath, 0700); err != nil {
753-
log.Fatal("Failed to create '%s': %v", LFS.ContentPath, err)
754-
}
755-
756752
LFS.JWTSecretBytes = make([]byte, 32)
757753
n, err := base64.RawURLEncoding.Decode(LFS.JWTSecretBytes, []byte(LFS.JWTSecretBase64))
758754

@@ -1111,11 +1107,20 @@ func loadOrGenerateInternalToken(sec *ini.Section) string {
11111107
return token
11121108
}
11131109

1110+
func ensureLFSDirectory() {
1111+
if LFS.StartServer {
1112+
if err := os.MkdirAll(LFS.ContentPath, 0700); err != nil {
1113+
log.Fatal("Failed to create '%s': %v", LFS.ContentPath, err)
1114+
}
1115+
}
1116+
}
1117+
11141118
// NewServices initializes the services
11151119
func NewServices() {
11161120
InitDBConfig()
11171121
newService()
11181122
NewLogServices(false)
1123+
ensureLFSDirectory()
11191124
newCacheService()
11201125
newSessionService()
11211126
newCORSService()

0 commit comments

Comments
 (0)