File tree Expand file tree Collapse file tree 3 files changed +18
-10
lines changed
src/implementation/Client Expand file tree Collapse file tree 3 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -53,14 +53,14 @@ export default class DaprClient {
5353 readonly actor : IClientActorBuilder ;
5454
5555 constructor (
56- daprHost ?: string
56+ daprHost = Settings . getDefaultHost ( )
5757 , daprPort ?: string
5858 , communicationProtocol : CommunicationProtocolEnum = CommunicationProtocolEnum . HTTP
5959 , options : DaprClientOptions = {
6060 isKeepAlive : true
6161 }
6262 ) {
63- this . daprHost = daprHost ?? Settings . getDefaultHost ( ) ;
63+ this . daprHost = daprHost ;
6464 this . daprPort = daprPort ?? Settings . getDefaultPort ( communicationProtocol ) ;
6565 this . communicationProtocol = communicationProtocol ;
6666 this . options = options ;
Original file line number Diff line number Diff line change @@ -13,9 +13,13 @@ export default class GRPCClient implements IClient {
1313 private readonly clientPort : string ;
1414 private readonly options : DaprClientOptions ;
1515
16- constructor ( host ?: string , port ?: string , options : DaprClientOptions = {
17- isKeepAlive : true
18- } ) {
16+ constructor (
17+ host = Settings . getDefaultHost ( )
18+ , port = Settings . getDefaultGrpcPort ( )
19+ , options : DaprClientOptions = {
20+ isKeepAlive : true
21+ }
22+ ) {
1923 this . clientHost = host ?? Settings . getDefaultHost ( ) ;
2024 this . clientPort = port ?? Settings . getDefaultGrpcPort ( ) ;
2125 this . clientCredentials = ChannelCredentials . createInsecure ( ) ;
Original file line number Diff line number Diff line change @@ -16,11 +16,15 @@ export default class HTTPClient implements IClient {
1616 private readonly httpAgent ;
1717 private readonly httpsAgent ;
1818
19- constructor ( host ?: string , port ?: string , options : DaprClientOptions = {
20- isKeepAlive : true
21- } ) {
22- this . clientHost = host ?? Settings . getDefaultHost ( ) ;
23- this . clientPort = port ?? Settings . getDefaultHttpPort ( ) ;
19+ constructor (
20+ host = Settings . getDefaultHost ( )
21+ , port = Settings . getDefaultHttpPort ( )
22+ , options : DaprClientOptions = {
23+ isKeepAlive : true
24+ }
25+ ) {
26+ this . clientHost = host ;
27+ this . clientPort = port ?? port ;
2428 this . options = options ;
2529
2630 if ( ! this . clientHost . startsWith ( 'http://' ) && ! this . clientHost . startsWith ( 'https://' ) ) {
You can’t perform that action at this time.
0 commit comments