You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
671 B
35 lines
671 B
package main |
|
|
|
import ( |
|
clientv3 "go.etcd.io/etcd/client/v3" |
|
"google.golang.org/grpc/grpclog" |
|
"sonet/internal/auth/logic" |
|
"sonet/pkg/config" |
|
"sonet/pkg/grpc/discovery" |
|
"sonet/pkg/utils/logger" |
|
"sonet/pkg/utils/shutdown" |
|
) |
|
|
|
func main() { |
|
grpclog.SetLoggerV2(logger.Logger) |
|
|
|
conf := config.LoadConfig(nil, "cmd/auth") |
|
|
|
// registry and run... |
|
etcdClient, err := clientv3.New(conf.Etcd) |
|
if err != nil { |
|
panic(err) |
|
} |
|
|
|
registry := discovery.NewRegister(etcdClient) |
|
shutdown.AddShutdownHook(registry.Stop) |
|
authServer := logic.NewAuthServer() |
|
go func() { |
|
err = authServer.Run(conf.Grpc, registry) |
|
if err != nil { |
|
panic(err) |
|
} |
|
}() |
|
|
|
shutdown.Await() |
|
}
|
|
|