slaventius 2 years ago
parent 7391a785ec
commit 61a3b369da
  1. 1
      .gitignore
  2. BIN
      authService
  3. 44
      cmd/main.go

1
.gitignore vendored

@ -0,0 +1 @@
authService

Binary file not shown.

@ -30,57 +30,19 @@ func main() {
for {
select {
case <-signalChannel:
fmt.Println("authServer stopping ...")
return
case <-ctx.Done():
fmt.Println("authServer stopping ...")
return
}
}
// connStr := fmt.Sprintf("%s:%d", config.Db.Host, config.Db.Port)
// conn, erc := grpc.Dial(connStr, grpc.WithInsecure())
// if erc != nil {
// log.Fatal(erc)
// }
// defer conn.Close()
// //
// ctx := context.Background()
// cli := api.NewAuthDBClient(conn)
// fmt.Printf("Connect to DB on %v\n", connStr)
// //
// _, era := cli.Login(ctx, &api.LoginRequest{Login: "vasya", Password: "123"})
// if era != nil {
// status := status.Convert(era)
// if status.Message() == "login unknown" {
// reg, err := cli.Registration(ctx, &api.RegistrationRequest{
// Login: "vasya",
// Email: "vasya@mail.ru",
// })
// if err != nil {
// log.Fatal(err)
// }
// fmt.Println(reg)
// } else if status.Message() == "login unconfirmed" {
// code := "283164522"
// _, erc := cli.Confirmation(ctx, &api.ConfirmationRequest{Code: code})
// if erc != nil {
// log.Fatal(erc)
// }
// }
// }
}
// Остановка сервера
func stop(signalChannel chan os.Signal, s *server.AuthServer) {
defer s.Close()
defer signal.Stop(signalChannel)
signal.Stop(signalChannel)
log.Println("authServer stopping ...")
}
// Запуск сервера
@ -88,7 +50,7 @@ func start(ctx context.Context, config *config.Config, s *server.AuthServer) {
connStr := fmt.Sprintf(":%d", config.App.Port)
//
log.Printf("authServer up (%s)\n", connStr)
log.Printf("authServer starting (%s)\n", connStr)
//
err := http.ListenAndServe(connStr, s.Router) // router

Loading…
Cancel
Save