Skip to content

Commit ea74ee8

Browse files
committed
add: healthz
1 parent 73d940c commit ea74ee8

4 files changed

Lines changed: 104 additions & 64 deletions

File tree

cmd/di/wire.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/remove158/chula-sso/cmd/routes"
1111
"github.com/remove158/chula-sso/internal/services"
1212
)
13-
1413
type Server struct {
1514
AuthRoute routes.IAuthRoute
1615
Gin *gin.Engine
@@ -37,6 +36,7 @@ func InitializeServer(
3736
}
3837

3938
func InitializeGin() *gin.Engine {
39+
4040
return gin.Default()
4141
}
4242

cmd/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import (
66
cors "github.com/gin-contrib/cors"
77
_ "github.com/joho/godotenv/autoload"
88
"github.com/remove158/chula-sso/cmd/di"
9+
healthcheck "github.com/tavsec/gin-healthcheck"
10+
"github.com/tavsec/gin-healthcheck/checks"
11+
health_config "github.com/tavsec/gin-healthcheck/config"
912
)
1013

1114
func main() {
@@ -15,6 +18,7 @@ func main() {
1518
config := cors.DefaultConfig()
1619
config.AllowAllOrigins = true
1720
config.AllowHeaders = append(config.AllowHeaders, "DeeAppId", "DeeAppSecret", "DeeTicket")
21+
healthcheck.New(server.Gin, health_config.DefaultConfig(), []checks.Check{})
1822

1923
server.Gin.Use(cors.New(config))
2024

go.mod

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,44 @@ module github.com/remove158/chula-sso
33
go 1.18
44

55
require (
6+
github.com/gin-contrib/cors v1.4.0
7+
github.com/gin-gonic/gin v1.9.0
8+
github.com/golang/mock v1.6.0
9+
github.com/google/uuid v1.3.0
10+
github.com/google/wire v0.5.0
11+
github.com/joho/godotenv v1.4.0
12+
github.com/kelseyhightower/envconfig v1.4.0
13+
github.com/stretchr/testify v1.8.2
14+
github.com/tavsec/gin-healthcheck v1.2.0
15+
)
16+
17+
require (
18+
github.com/bytedance/sonic v1.8.5 // indirect
19+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
20+
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
621
github.com/davecgh/go-spew v1.1.1 // indirect
7-
github.com/gin-contrib/cors v1.4.0 // indirect
22+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
823
github.com/gin-contrib/sse v0.1.0 // indirect
9-
github.com/gin-gonic/gin v1.8.1 // indirect
10-
github.com/go-playground/locales v0.14.0 // indirect
11-
github.com/go-playground/universal-translator v0.18.0 // indirect
12-
github.com/go-playground/validator/v10 v10.11.1 // indirect
13-
github.com/goccy/go-json v0.9.11 // indirect
14-
github.com/golang/mock v1.6.0 // indirect
15-
github.com/google/subcommands v1.0.1 // indirect
16-
github.com/google/uuid v1.3.0 // indirect
17-
github.com/google/wire v0.5.0 // indirect
18-
github.com/joho/godotenv v1.4.0 // indirect
24+
github.com/go-playground/locales v0.14.1 // indirect
25+
github.com/go-playground/universal-translator v0.18.1 // indirect
26+
github.com/go-playground/validator/v10 v10.12.0 // indirect
27+
github.com/goccy/go-json v0.10.2 // indirect
1928
github.com/json-iterator/go v1.1.12 // indirect
20-
github.com/kelseyhightower/envconfig v1.4.0 // indirect
21-
github.com/leodido/go-urn v1.2.1 // indirect
22-
github.com/mattn/go-isatty v0.0.16 // indirect
29+
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
30+
github.com/leodido/go-urn v1.2.2 // indirect
31+
github.com/mattn/go-isatty v0.0.17 // indirect
2332
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2433
github.com/modern-go/reflect2 v1.0.2 // indirect
25-
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
34+
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
2635
github.com/pmezard/go-difflib v1.0.0 // indirect
27-
github.com/stretchr/testify v1.8.1 // indirect
28-
github.com/ugorji/go/codec v1.2.7 // indirect
29-
golang.org/x/crypto v0.1.0 // indirect
30-
golang.org/x/mod v0.6.0 // indirect
31-
golang.org/x/net v0.1.0 // indirect
32-
golang.org/x/sys v0.1.0 // indirect
33-
golang.org/x/text v0.4.0 // indirect
34-
golang.org/x/tools v0.2.0 // indirect
35-
google.golang.org/protobuf v1.28.1 // indirect
36-
gopkg.in/yaml.v2 v2.4.0 // indirect
36+
github.com/redis/go-redis/v9 v9.0.3 // indirect
37+
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
38+
github.com/ugorji/go/codec v1.2.11 // indirect
39+
golang.org/x/arch v0.3.0 // indirect
40+
golang.org/x/crypto v0.7.0 // indirect
41+
golang.org/x/net v0.8.0 // indirect
42+
golang.org/x/sys v0.6.0 // indirect
43+
golang.org/x/text v0.8.0 // indirect
44+
google.golang.org/protobuf v1.30.0 // indirect
3745
gopkg.in/yaml.v3 v3.0.1 // indirect
3846
)

0 commit comments

Comments
 (0)