File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,20 @@ const api = axios.create();
7
7
const setupClient = ( argv ) => {
8
8
const apiPrefix = 'api/v1' ;
9
9
const { endpoint, rejectUnauthorized, dataSourcePathPrefix } = argv || { } ;
10
+ if ( ! endpoint ) {
11
+ return ;
12
+ }
10
13
const tmp = pathLib . join ( dataSourcePathPrefix , apiPrefix ) ;
11
- const baseURL = new URL ( tmp , endpoint ) ;
12
- api . defaults . baseURL = baseURL . toString ( ) ;
13
- if ( baseURL . protocol === 'https:' ) {
14
- const agent = new https . Agent ( { rejectUnauthorized } ) ;
15
- api . defaults . httpsAgent = agent ;
14
+ try {
15
+ const baseURL = new URL ( tmp , endpoint ) ;
16
+ api . defaults . baseURL = baseURL . toString ( ) ;
17
+ if ( baseURL . protocol === 'https:' ) {
18
+ const agent = new https . Agent ( { rejectUnauthorized } ) ;
19
+ api . defaults . httpsAgent = agent ;
20
+ }
21
+ }
22
+ catch ( error ) {
23
+ console . error ( error ) ;
16
24
}
17
25
} ;
18
26
You can’t perform that action at this time.
0 commit comments