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 {
53
53
readonly actor : IClientActorBuilder ;
54
54
55
55
constructor (
56
- daprHost ?: string
56
+ daprHost = Settings . getDefaultHost ( )
57
57
, daprPort ?: string
58
58
, communicationProtocol : CommunicationProtocolEnum = CommunicationProtocolEnum . HTTP
59
59
, options : DaprClientOptions = {
60
60
isKeepAlive : true
61
61
}
62
62
) {
63
- this . daprHost = daprHost ?? Settings . getDefaultHost ( ) ;
63
+ this . daprHost = daprHost ;
64
64
this . daprPort = daprPort ?? Settings . getDefaultPort ( communicationProtocol ) ;
65
65
this . communicationProtocol = communicationProtocol ;
66
66
this . options = options ;
Original file line number Diff line number Diff line change @@ -13,9 +13,13 @@ export default class GRPCClient implements IClient {
13
13
private readonly clientPort : string ;
14
14
private readonly options : DaprClientOptions ;
15
15
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
+ ) {
19
23
this . clientHost = host ?? Settings . getDefaultHost ( ) ;
20
24
this . clientPort = port ?? Settings . getDefaultGrpcPort ( ) ;
21
25
this . clientCredentials = ChannelCredentials . createInsecure ( ) ;
Original file line number Diff line number Diff line change @@ -16,11 +16,15 @@ export default class HTTPClient implements IClient {
16
16
private readonly httpAgent ;
17
17
private readonly httpsAgent ;
18
18
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 ;
24
28
this . options = options ;
25
29
26
30
if ( ! this . clientHost . startsWith ( 'http://' ) && ! this . clientHost . startsWith ( 'https://' ) ) {
You can’t perform that action at this time.
0 commit comments