@@ -49,7 +49,7 @@ import (
49
49
"gitea.com/go-chi/session"
50
50
)
51
51
52
- func guaranteeInit (fn func () error ) {
52
+ func mustInit (fn func () error ) {
53
53
err := fn ()
54
54
if err != nil {
55
55
ptr := reflect .ValueOf (fn ).Pointer ()
@@ -58,7 +58,7 @@ func guaranteeInit(fn func() error) {
58
58
}
59
59
}
60
60
61
- func guaranteeInitCtx (ctx context.Context , fn func (ctx context.Context ) error ) {
61
+ func mustInitCtx (ctx context.Context , fn func (ctx context.Context ) error ) {
62
62
err := fn (ctx )
63
63
if err != nil {
64
64
ptr := reflect .ValueOf (fn ).Pointer ()
@@ -70,8 +70,8 @@ func guaranteeInitCtx(ctx context.Context, fn func(ctx context.Context) error) {
70
70
// InitGitServices init new services for git, this is also called in `contrib/pr/checkout.go`
71
71
func InitGitServices () {
72
72
setting .NewServices ()
73
- guaranteeInit (storage .Init )
74
- guaranteeInit (repository .NewContext )
73
+ mustInit (storage .Init )
74
+ mustInit (repository .NewContext )
75
75
}
76
76
77
77
func syncAppPathForGit (ctx context.Context ) (err error ) {
@@ -83,10 +83,10 @@ func syncAppPathForGit(ctx context.Context) (err error) {
83
83
log .Info ("AppPath changed from '%s' to '%s'" , runtimeState .LastAppPath , setting .AppPath )
84
84
85
85
log .Info ("re-sync repository hooks ..." )
86
- guaranteeInitCtx (ctx , repo_module .SyncRepositoryHooks )
86
+ mustInitCtx (ctx , repo_module .SyncRepositoryHooks )
87
87
88
88
log .Info ("re-write ssh public keys ..." )
89
- guaranteeInit (models .RewriteAllPublicKeys )
89
+ mustInit (models .RewriteAllPublicKeys )
90
90
91
91
runtimeState .LastAppPath = setting .AppPath
92
92
return setting .AppState .Set (runtimeState )
@@ -101,7 +101,7 @@ func GlobalInit(ctx context.Context) {
101
101
log .Fatal ("Gitea is not installed" )
102
102
}
103
103
104
- guaranteeInitCtx (ctx , git .Init )
104
+ mustInitCtx (ctx , git .Init )
105
105
log .Info (git .VersionInfo ())
106
106
107
107
git .CheckLFSVersion ()
@@ -117,9 +117,9 @@ func GlobalInit(ctx context.Context) {
117
117
118
118
InitGitServices ()
119
119
mailer .NewContext ()
120
- guaranteeInit (cache .NewContext )
120
+ mustInit (cache .NewContext )
121
121
notification .NewContext ()
122
- guaranteeInit (archiver .Init )
122
+ mustInit (archiver .Init )
123
123
124
124
highlight .NewContext ()
125
125
external .RegisterRenderers ()
@@ -131,27 +131,27 @@ func GlobalInit(ctx context.Context) {
131
131
log .Fatal ("SQLite3 is set in settings but NOT Supported" )
132
132
}
133
133
134
- guaranteeInitCtx (ctx , common .InitDBEngine )
134
+ mustInitCtx (ctx , common .InitDBEngine )
135
135
log .Info ("ORM engine initialization successful!" )
136
136
137
- guaranteeInit (oauth2 .Init )
137
+ mustInit (oauth2 .Init )
138
138
139
139
models .NewRepoContext ()
140
140
141
141
// Booting long running goroutines.
142
142
cron .NewContext ()
143
143
issue_indexer .InitIssueIndexer (false )
144
144
code_indexer .Init ()
145
- guaranteeInit (stats_indexer .Init )
145
+ mustInit (stats_indexer .Init )
146
146
147
147
mirror_service .InitSyncMirrors ()
148
148
webhook .InitDeliverHooks ()
149
- guaranteeInit (pull_service .Init )
150
- guaranteeInit (task .Init )
151
- guaranteeInit (repo_migrations .Init )
149
+ mustInit (pull_service .Init )
150
+ mustInit (task .Init )
151
+ mustInit (repo_migrations .Init )
152
152
eventsource .GetManager ().Init ()
153
153
154
- guaranteeInitCtx (ctx , syncAppPathForGit )
154
+ mustInitCtx (ctx , syncAppPathForGit )
155
155
156
156
if setting .SSH .StartBuiltinServer {
157
157
ssh .Listen (setting .SSH .ListenHost , setting .SSH .ListenPort , setting .SSH .ServerCiphers , setting .SSH .ServerKeyExchanges , setting .SSH .ServerMACs )
0 commit comments