slaventius 2 years ago
parent 9a5e402e47
commit 12a2c20b06
  1. 2
      .vscode/launch.json
  2. 2
      go.mod
  3. 2
      go.sum
  4. 13
      internal/auth.go
  5. 19
      internal/transport/grpc/grpc.go

@ -14,7 +14,7 @@
"DB_HOST": "127.0.0.1",
"DB_PORT": "9995",
"APP_PORT": "9994",
"SENTRY_DSN": "https://3f4b31dbbd9a4a6b8a71f9881d962f25@o4504654569799680.ingest.sentry.io/4504654572683264"
// "SENTRY_DSN": "https://3f4b31dbbd9a4a6b8a71f9881d962f25@o4504654569799680.ingest.sentry.io/4504654572683264"
},
"args": []
}

@ -3,7 +3,7 @@ module git.slaventius.ru/test3k/auth
go 1.19
require (
git.slaventius.ru/test3k/umate v0.0.0-20230213064240-bf21e2057702
git.slaventius.ru/test3k/umate v0.0.0-20230224071336-c256dd02b0f7
github.com/go-chi/chi/v5 v5.0.8
github.com/kelseyhightower/envconfig v1.4.0
google.golang.org/grpc v1.52.3

@ -1,5 +1,7 @@
git.slaventius.ru/test3k/umate v0.0.0-20230213064240-bf21e2057702 h1:C80T3ynUeO7wpGXIZSCNN3tLYpDqH4j/I06LVoBtoXs=
git.slaventius.ru/test3k/umate v0.0.0-20230213064240-bf21e2057702/go.mod h1:xE7ik2EnLB+CNDJA5+HbRIwAk+V7sgUjS0HPeXS5Ka0=
git.slaventius.ru/test3k/umate v0.0.0-20230224071336-c256dd02b0f7 h1:Eo+tW2vVUvhz3mMR04QCzxTx51M0rQfQKV4M6Y/3dBM=
git.slaventius.ru/test3k/umate v0.0.0-20230224071336-c256dd02b0f7/go.mod h1:xE7ik2EnLB+CNDJA5+HbRIwAk+V7sgUjS0HPeXS5Ka0=
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d h1:S2NE3iHSwP0XV47EEXL8mWmRdEfGscSJ+7EgePNgt0s=
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

@ -48,6 +48,19 @@ func (s *AuthServer) GracefulStop() error {
func healthz(s *AuthServer) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// err := s.db.Check()
// if err != nil {
// status := status.Convert(err)
// //
// s.logger.Error(status.Message())
// //
// w.Write([]byte(status.Message()))
// return
// }
w.WriteHeader(http.StatusOK)
w.Write([]byte("ok"))
}

@ -18,7 +18,8 @@ type AuthDBClient struct {
config *config.Config
client *grpc.ClientConn
db api.AuthDBClient
ctx context.Context
// hlz api.HealthClient
ctx context.Context
}
func NewDBClient(ctx context.Context, config *config.Config) *AuthDBClient {
@ -33,7 +34,8 @@ func NewDBClient(ctx context.Context, config *config.Config) *AuthDBClient {
config: config,
client: client,
db: api.NewAuthDBClient(client),
ctx: ctx,
// hlz: api.NewHealthClient(client),
ctx: ctx,
}
}
@ -82,3 +84,16 @@ func (s *AuthDBClient) Confirmation(code string) error {
return nil
}
// func (s *AuthDBClient) Check() error {
// _, err := s.hlz.Check(s.ctx, &api.HealthCheckRequest{
// Service: "Check",
// })
// //
// if err != nil {
// return err
// }
// return nil
// }

Loading…
Cancel
Save