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"
4
4
import IClient from "../../../interfaces/Client/IClient" ;
5
5
import CommunicationProtocolEnum from "../../../enum/CommunicationProtocol.enum" ;
6
6
import { DaprClientOptions } from "../../../types/DaprClientOptions" ;
7
+ import { Settings } from '../../../utils/Settings.util' ;
7
8
8
9
export default class GRPCClient implements IClient {
9
- private isInitialized : boolean ;
10
10
private readonly client : DaprClient ;
11
11
private readonly clientCredentials : grpc . ChannelCredentials ;
12
12
private readonly clientHost : string ;
13
13
private readonly clientPort : string ;
14
14
private readonly options : DaprClientOptions ;
15
15
16
- constructor ( host = "127.0.0.1" , port = "50050" , options : DaprClientOptions = {
16
+ constructor ( host ?: string , port ?: string , options : DaprClientOptions = {
17
17
isKeepAlive : true
18
18
} ) {
19
- this . isInitialized = true ;
20
- this . clientHost = host ;
21
- this . clientPort = port ;
19
+ this . clientHost = host ?? Settings . getDefaultHost ( ) ;
20
+ this . clientPort = port ?? Settings . getDefaultGrpcPort ( ) ;
22
21
this . clientCredentials = ChannelCredentials . createInsecure ( ) ;
23
22
this . options = options ;
24
23
Original file line number Diff line number Diff line change @@ -4,9 +4,9 @@ import IClient from "../../../interfaces/Client/IClient";
4
4
import http from "http" ;
5
5
import https from "https" ;
6
6
import { DaprClientOptions } from "../../../types/DaprClientOptions" ;
7
+ import { Settings } from '../../../utils/Settings.util' ;
7
8
8
9
export default class HTTPClient implements IClient {
9
- private readonly isInitialized : boolean ;
10
10
private client : typeof fetch ;
11
11
private readonly clientHost : string ;
12
12
private readonly clientPort : string ;
@@ -16,12 +16,11 @@ export default class HTTPClient implements IClient {
16
16
private readonly httpAgent ;
17
17
private readonly httpsAgent ;
18
18
19
- constructor ( host = "127.0.0.1" , port = "50050" , options : DaprClientOptions = {
19
+ constructor ( host ?: string , port ?: string , options : DaprClientOptions = {
20
20
isKeepAlive : true
21
21
} ) {
22
- this . isInitialized = true ;
23
- this . clientHost = host ;
24
- this . clientPort = port ;
22
+ this . clientHost = host ?? Settings . getDefaultHost ( ) ;
23
+ this . clientPort = port ?? Settings . getDefaultHttpPort ( ) ;
25
24
this . options = options ;
26
25
27
26
if ( ! this . clientHost . startsWith ( 'http://' ) && ! this . clientHost . startsWith ( 'https://' ) ) {
You can’t perform that action at this time.
0 commit comments