File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
16
16
"code.gitea.io/gitea/modules/web"
17
17
"code.gitea.io/gitea/modules/web/middleware"
18
18
"code.gitea.io/gitea/routers/common"
19
+ "code.gitea.io/gitea/routers/web/healthcheck"
19
20
"code.gitea.io/gitea/services/forms"
20
21
21
22
"gitea.com/go-chi/session"
@@ -106,6 +107,7 @@ func Routes() *web.Route {
106
107
r .Use (Init )
107
108
r .Get ("/" , Install )
108
109
r .Post ("/" , web .Bind (forms.InstallForm {}), SubmitInstall )
110
+ r .Get ("/api/healthz" , healthcheck .CheckInstall )
109
111
110
112
r .NotFound (web .Wrap (installNotFound ))
111
113
return r
Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ type checks map[string][]componentStatus
50
50
// response is the data returned by the health endpoint, which will be marshaled to JSON format
51
51
type response struct {
52
52
Status status `json:"status"`
53
- Description string `json:"description"` // a human-friendly description of the service
54
- Checks checks `json:"checks"` // The Checks Object
53
+ Description string `json:"description"` // a human-friendly description of the service
54
+ Checks checks `json:"checks,omitempty "` // The Checks Object, should be omitted on installation route
55
55
}
56
56
57
57
// componentStatus presents one status of a single check object
@@ -88,6 +88,19 @@ func Check(w http.ResponseWriter, r *http.Request) {
88
88
_ , _ = w .Write (data )
89
89
}
90
90
91
+ // CheckInstall always return pass. Should only be used in Install routes
92
+ func CheckInstall (w http.ResponseWriter , r * http.Request ) {
93
+ rsp := response {
94
+ Status : pass ,
95
+ Description : "Gitea: Installation stage" ,
96
+ }
97
+
98
+ data , _ := json .MarshalIndent (rsp , "" , " " )
99
+ w .Header ().Set ("Content-Type" , "application/json" )
100
+ w .WriteHeader (rsp .Status .ToHTTPStatus ())
101
+ _ , _ = w .Write (data )
102
+ }
103
+
91
104
// database checks gitea database status
92
105
func checkDatabase (checks checks ) status {
93
106
st := componentStatus {}
You can’t perform that action at this time.
0 commit comments