@@ -14,6 +14,7 @@ import (
1414 "code.gitea.io/gitea/modules/git"
1515 "code.gitea.io/gitea/modules/log"
1616 "code.gitea.io/gitea/modules/setting"
17+ "code.gitea.io/gitea/modules/storage"
1718)
1819
1920// Check represents a Doctor check
@@ -25,6 +26,7 @@ type Check struct {
2526 AbortIfFailed bool
2627 SkipDatabaseInitialization bool
2728 Priority int
29+ InitStorage bool
2830}
2931
3032func initDBSkipLogger (ctx context.Context ) error {
@@ -84,6 +86,7 @@ func RunChecks(ctx context.Context, colorize, autofix bool, checks []*Check) err
8486 logger := log .BaseLoggerToGeneralLogger (& doctorCheckLogger {colorize : colorize })
8587 loggerStep := log .BaseLoggerToGeneralLogger (& doctorCheckStepLogger {colorize : colorize })
8688 dbIsInit := false
89+ storageIsInit := false
8790 for i , check := range checks {
8891 if ! dbIsInit && ! check .SkipDatabaseInitialization {
8992 // Only open database after the most basic configuration check
@@ -94,6 +97,14 @@ func RunChecks(ctx context.Context, colorize, autofix bool, checks []*Check) err
9497 }
9598 dbIsInit = true
9699 }
100+ if ! storageIsInit && check .InitStorage {
101+ if err := storage .Init (); err != nil {
102+ logger .Error ("Error whilst initializing the storage: %v" , err )
103+ logger .Error ("Check if you are using the right config file. You can use a --config directive to specify one." )
104+ return nil
105+ }
106+ storageIsInit = true
107+ }
97108 logger .Info ("\n [%d] %s" , i + 1 , check .Title )
98109 if err := check .Run (ctx , loggerStep , autofix ); err != nil {
99110 if check .AbortIfFailed {
0 commit comments