mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 12:44:19 +01:00
Add AdminService (#176)
* add admin service * go mod tidy * fix linter: grpc.Dial * fix ocean get balance * fix linter * add .vscode to gitignore * rework admin balance API * fix mockedwallet in covenantless pkg * make proto
This commit is contained in:
@@ -40,7 +40,8 @@ func NewService(
|
||||
}
|
||||
|
||||
grpcConfig := []grpc.ServerOption{
|
||||
interceptors.UnaryInterceptor(), interceptors.StreamInterceptor(),
|
||||
interceptors.UnaryInterceptor(svcConfig.AuthUser, svcConfig.AuthPass),
|
||||
interceptors.StreamInterceptor(),
|
||||
}
|
||||
if !svcConfig.NoTLS {
|
||||
return nil, fmt.Errorf("tls termination not supported yet")
|
||||
@@ -53,8 +54,13 @@ func NewService(
|
||||
|
||||
// Server grpc.
|
||||
grpcServer := grpc.NewServer(grpcConfig...)
|
||||
|
||||
appHandler := handlers.NewHandler(appConfig.AppService())
|
||||
arkv1.RegisterArkServiceServer(grpcServer, appHandler)
|
||||
|
||||
adminHandler := handlers.NewAdminHandler(appConfig.AdminService())
|
||||
arkv1.RegisterAdminServiceServer(grpcServer, adminHandler)
|
||||
|
||||
healthHandler := handlers.NewHealthHandler()
|
||||
grpchealth.RegisterHealthServer(grpcServer, healthHandler)
|
||||
|
||||
@@ -91,6 +97,11 @@ func NewService(
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := arkv1.RegisterAdminServiceHandler(
|
||||
ctx, gwmux, conn,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
grpcGateway := http.Handler(gwmux)
|
||||
|
||||
handler := router(grpcServer, grpcGateway)
|
||||
|
||||
Reference in New Issue
Block a user