Skip to content

Commit

Permalink
chore: remove grpc-js dependency as its bundled from nice-grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-KumarH committed Nov 17, 2024
1 parent 80a2fb9 commit 208e65a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restorecommerce/chassis-srv",
"version": "1.6.4",
"version": "1.6.5",
"description": "Restore Commerce microservice chassis",
"main": "./lib/index.js",
"author": "n-fuse GmbH",
Expand All @@ -17,7 +17,6 @@
],
"typings": "lib/index.d.ts",
"dependencies": {
"@grpc/grpc-js": "1.12.2",
"@restorecommerce/grpc-client": "2.2.5",
"@restorecommerce/kafka-client": "1.2.20",
"@restorecommerce/logger": "^1.3.1",
Expand Down
4 changes: 2 additions & 2 deletions src/microservice/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createLogger } from '@restorecommerce/logger';
import { Logger } from 'winston';
import * as _ from 'lodash';
import { EventEmitter } from 'events';
import { BindConfig, grpc } from './transport/provider/grpc';
import { BindConfig, grpcServer } from './transport/provider/grpc';

const transports: Record<string, any> = {};

Expand All @@ -17,7 +17,7 @@ export const registerTransport = (name: string, provider: any): void => {
};

// register included providers
registerTransport('grpc', grpc);
registerTransport('grpc', grpcServer);

/**
* Initializes all configured transports.
Expand Down
9 changes: 2 additions & 7 deletions src/microservice/transport/provider/grpc/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as grpc from '@grpc/grpc-js';
import * as _ from 'lodash';
import { Logger } from 'winston';
import type { Server as GRPCServer, ServiceImplementation } from 'nice-grpc';
Expand Down Expand Up @@ -46,8 +45,6 @@ export class Server {
this.config = config;
this.logger = logger;

grpc.setLogger(console);

this.server = createServer()
.use(tracingMiddleware)
.use(metaMiddleware)
Expand All @@ -70,15 +67,13 @@ export class Server {
*/
async start(): Promise<void> {
if (!this.isBound) {
const credentials = grpc.ServerCredentials.createInsecure();
if (_.has(this.config, 'credentials.ssl')) {
// TODO Re-enable
// credentials = grpc.credentials.createSsl(
// this.config.credentials.ssl.certs);
}
await this.server.listen(
this.config.addr,
credentials
this.config.addr
).catch(err => {
this.logger.error('Error starting server', { message: err.message, code: err.code, stack: err.stack });
throw err;
Expand All @@ -95,4 +90,4 @@ export class Server {
}
}

export { Server as grpc };
export { Server as grpcServer };

0 comments on commit 208e65a

Please sign in to comment.