File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
src/implementation/Client Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -4,21 +4,20 @@ import { DaprClient } from "../../../proto/dapr/proto/runtime/v1/dapr_grpc_pb"
44import IClient from "../../../interfaces/Client/IClient" ;
55import CommunicationProtocolEnum from "../../../enum/CommunicationProtocol.enum" ;
66import { DaprClientOptions } from "../../../types/DaprClientOptions" ;
7+ import { Settings } from '../../../utils/Settings.util' ;
78
89export default class GRPCClient implements IClient {
9- private isInitialized : boolean ;
1010 private readonly client : DaprClient ;
1111 private readonly clientCredentials : grpc . ChannelCredentials ;
1212 private readonly clientHost : string ;
1313 private readonly clientPort : string ;
1414 private readonly options : DaprClientOptions ;
1515
16- constructor ( host = "127.0.0.1" , port = "50050" , options : DaprClientOptions = {
16+ constructor ( host ?: string , port ?: string , options : DaprClientOptions = {
1717 isKeepAlive : true
1818 } ) {
19- this . isInitialized = true ;
20- this . clientHost = host ;
21- this . clientPort = port ;
19+ this . clientHost = host ?? Settings . getDefaultHost ( ) ;
20+ this . clientPort = port ?? Settings . getDefaultGrpcPort ( ) ;
2221 this . clientCredentials = ChannelCredentials . createInsecure ( ) ;
2322 this . options = options ;
2423
Original file line number Diff line number Diff line change @@ -4,9 +4,9 @@ import IClient from "../../../interfaces/Client/IClient";
44import http from "http" ;
55import https from "https" ;
66import { DaprClientOptions } from "../../../types/DaprClientOptions" ;
7+ import { Settings } from '../../../utils/Settings.util' ;
78
89export default class HTTPClient implements IClient {
9- private readonly isInitialized : boolean ;
1010 private client : typeof fetch ;
1111 private readonly clientHost : string ;
1212 private readonly clientPort : string ;
@@ -16,12 +16,11 @@ export default class HTTPClient implements IClient {
1616 private readonly httpAgent ;
1717 private readonly httpsAgent ;
1818
19- constructor ( host = "127.0.0.1" , port = "50050" , options : DaprClientOptions = {
19+ constructor ( host ?: string , port ?: string , options : DaprClientOptions = {
2020 isKeepAlive : true
2121 } ) {
22- this . isInitialized = true ;
23- this . clientHost = host ;
24- this . clientPort = port ;
22+ this . clientHost = host ?? Settings . getDefaultHost ( ) ;
23+ this . clientPort = port ?? Settings . getDefaultHttpPort ( ) ;
2524 this . options = options ;
2625
2726 if ( ! this . clientHost . startsWith ( 'http://' ) && ! this . clientHost . startsWith ( 'https://' ) ) {
You can’t perform that action at this time.
0 commit comments