Merge branch 'bugfix/grpc-options' of https://github.com/sjkummer/nest into sjkummer-bugfix/grpc-options

This commit is contained in:
Kamil Myśliwiec
2020-05-24 13:51:51 +02:00
3 changed files with 25 additions and 0 deletions

View File

@@ -90,6 +90,7 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
const keepaliveOptions = this.getKeepaliveOptions();
const options: Record<string, string | number> = {
...this.options.channelOptions,
...maxMessageLengthOptions,
...keepaliveOptions,
};

View File

@@ -0,0 +1,22 @@
/// <reference types="node" />
/**
* An interface that contains options used when initializing a Channel instance.
* This listing is incomplete. Full reference: https://grpc.github.io/grpc/core/group__grpc__arg__keys.html
*/
export interface ChannelOptions {
'grpc.ssl_target_name_override'?: string;
'grpc.primary_user_agent'?: string;
'grpc.secondary_user_agent'?: string;
'grpc.default_authority'?: string;
'grpc.keepalive_time_ms'?: number;
'grpc.keepalive_timeout_ms'?: number;
'grpc.service_config'?: string;
'grpc.max_concurrent_streams'?: number;
'grpc.initial_reconnect_backoff_ms'?: number;
'grpc.max_reconnect_backoff_ms'?: number;
'grpc.use_local_subchannel_pool'?: number;
'grpc.max_send_message_length'?: number;
'grpc.max_receive_message_length'?: number;
[key: string]: string | number | undefined;
}

View File

@@ -10,6 +10,7 @@ import { Server } from '../server/server';
import { CustomTransportStrategy } from './custom-transport-strategy.interface';
import { Deserializer } from './deserializer.interface';
import { Serializer } from './serializer.interface';
import {ChannelOptions} from '../external/grpc-options.interface';
export type MicroserviceOptions =
| GrpcOptions
@@ -42,6 +43,7 @@ export interface GrpcOptions {
http2MinPingIntervalWithoutDataMs?: number;
http2MaxPingStrikes?: number;
};
channelOptions?: ChannelOptions;
credentials?: any;
protoPath: string | string[];
package: string | string[];