mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	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>
This commit is contained in:
		| @@ -749,10 +749,6 @@ func NewContext() { | |||||||
| 	LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(20 * time.Minute) | 	LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(20 * time.Minute) | ||||||
|  |  | ||||||
| 	if LFS.StartServer { | 	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) | 		LFS.JWTSecretBytes = make([]byte, 32) | ||||||
| 		n, err := base64.RawURLEncoding.Decode(LFS.JWTSecretBytes, []byte(LFS.JWTSecretBase64)) | 		n, err := base64.RawURLEncoding.Decode(LFS.JWTSecretBytes, []byte(LFS.JWTSecretBase64)) | ||||||
|  |  | ||||||
| @@ -1111,11 +1107,20 @@ func loadOrGenerateInternalToken(sec *ini.Section) string { | |||||||
| 	return token | 	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 | // NewServices initializes the services | ||||||
| func NewServices() { | func NewServices() { | ||||||
| 	InitDBConfig() | 	InitDBConfig() | ||||||
| 	newService() | 	newService() | ||||||
| 	NewLogServices(false) | 	NewLogServices(false) | ||||||
|  | 	ensureLFSDirectory() | ||||||
| 	newCacheService() | 	newCacheService() | ||||||
| 	newSessionService() | 	newSessionService() | ||||||
| 	newCORSService() | 	newCORSService() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user