Skip to content

Commit 0e988e5

Browse files
committed
fine tune
1 parent e65c7de commit 0e988e5

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

routers/install/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func Routes() *web.Route {
107107
r.Use(Init)
108108
r.Get("/", Install)
109109
r.Post("/", web.Bind(forms.InstallForm{}), SubmitInstall)
110-
r.Get("/api/healthz", healthcheck.CheckInstall)
110+
r.Get("/api/healthz", healthcheck.Check)
111111

112112
r.NotFound(web.Wrap(installNotFound))
113113
return r

routers/web/healthcheck/check.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ type componentStatus struct {
6767
func Check(w http.ResponseWriter, r *http.Request) {
6868
rsp := response{
6969
Status: pass,
70-
Description: "Gitea: Git with a cup of tea",
70+
Description: setting.AppName,
7171
Checks: make(checks),
7272
}
7373

7474
statuses := make([]status, 0)
75-
statuses = append(statuses, checkDatabase(rsp.Checks))
76-
statuses = append(statuses, checkCache(rsp.Checks))
77-
75+
if setting.InstallLock {
76+
statuses = append(statuses, checkDatabase(rsp.Checks))
77+
statuses = append(statuses, checkCache(rsp.Checks))
78+
}
7879
for _, s := range statuses {
7980
if s != pass {
8081
rsp.Status = fail
@@ -88,19 +89,6 @@ func Check(w http.ResponseWriter, r *http.Request) {
8889
_, _ = w.Write(data)
8990
}
9091

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-
10492
// database checks gitea database status
10593
func checkDatabase(checks checks) status {
10694
st := componentStatus{}

routers/web/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import (
3131
"code.gitea.io/gitea/routers/web/events"
3232
"code.gitea.io/gitea/routers/web/explore"
3333
"code.gitea.io/gitea/routers/web/feed"
34-
"code.gitea.io/gitea/routers/web/misc"
3534
"code.gitea.io/gitea/routers/web/healthcheck"
35+
"code.gitea.io/gitea/routers/web/misc"
3636
"code.gitea.io/gitea/routers/web/org"
3737
"code.gitea.io/gitea/routers/web/repo"
3838
"code.gitea.io/gitea/routers/web/user"

0 commit comments

Comments
 (0)