@@ -14,6 +14,7 @@ import (
14
14
"code.gitea.io/gitea/modules/git"
15
15
"code.gitea.io/gitea/modules/log"
16
16
"code.gitea.io/gitea/modules/setting"
17
+ "code.gitea.io/gitea/modules/storage"
17
18
)
18
19
19
20
// Check represents a Doctor check
@@ -25,6 +26,7 @@ type Check struct {
25
26
AbortIfFailed bool
26
27
SkipDatabaseInitialization bool
27
28
Priority int
29
+ InitStorage bool
28
30
}
29
31
30
32
func initDBSkipLogger (ctx context.Context ) error {
@@ -84,6 +86,7 @@ func RunChecks(ctx context.Context, colorize, autofix bool, checks []*Check) err
84
86
logger := log .BaseLoggerToGeneralLogger (& doctorCheckLogger {colorize : colorize })
85
87
loggerStep := log .BaseLoggerToGeneralLogger (& doctorCheckStepLogger {colorize : colorize })
86
88
dbIsInit := false
89
+ storageIsInit := false
87
90
for i , check := range checks {
88
91
if ! dbIsInit && ! check .SkipDatabaseInitialization {
89
92
// Only open database after the most basic configuration check
@@ -94,6 +97,14 @@ func RunChecks(ctx context.Context, colorize, autofix bool, checks []*Check) err
94
97
}
95
98
dbIsInit = true
96
99
}
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
+ }
97
108
logger .Info ("\n [%d] %s" , i + 1 , check .Title )
98
109
if err := check .Run (ctx , loggerStep , autofix ); err != nil {
99
110
if check .AbortIfFailed {
0 commit comments