File tree Expand file tree Collapse file tree 3 files changed +5
-15
lines changed
contentstack-export/src/utils
contentstack-import-setup/src/utils
contentstack-import/src/utils Expand file tree Collapse file tree 3 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -81,12 +81,8 @@ const setupConfig = async (exportCmdFlags: any): Promise<ExportConfig> => {
8181
8282 config . apiKey =
8383 exportCmdFlags [ 'stack-uid' ] || exportCmdFlags [ 'stack-api-key' ] || config . source_stack || ( await askAPIKey ( ) ) ;
84- if ( typeof config . apiKey !== 'string' ) {
85- log . debug ( 'Invalid API key received!' , { apiKey : config . apiKey } ) ;
86- throw new Error ( 'Invalid API key received' ) ;
87- }
88- if ( ! config . apiKey || ! config . apiKey . trim ( ) ) {
89- log . debug ( 'Empty API key received!' , { apiKey : config . apiKey } ) ;
84+ if ( typeof config . apiKey !== 'string' || ! config . apiKey || ! config . apiKey . trim ( ) ) {
85+ log . debug ( 'Invalid or empty API key received!' , { apiKey : config . apiKey } ) ;
9086 throw new Error ( 'Stack API key cannot be empty. Please provide a valid stack API key.' ) ;
9187 }
9288 }
Original file line number Diff line number Diff line change @@ -60,10 +60,7 @@ const setupConfig = async (importCmdFlags: any): Promise<ImportConfig> => {
6060 } else {
6161 config . apiKey =
6262 importCmdFlags [ 'stack-uid' ] || importCmdFlags [ 'stack-api-key' ] || config . target_stack || ( await askAPIKey ( ) ) ;
63- if ( typeof config . apiKey !== 'string' ) {
64- throw new Error ( 'Invalid API key received' ) ;
65- }
66- if ( ! config . apiKey || ! config . apiKey . trim ( ) ) {
63+ if ( typeof config . apiKey !== 'string' || ! config . apiKey || ! config . apiKey . trim ( ) ) {
6764 throw new Error ( 'Stack API key cannot be empty. Please provide a valid stack API key.' ) ;
6865 }
6966 }
Original file line number Diff line number Diff line change @@ -81,11 +81,8 @@ const setupConfig = async (importCmdFlags: any): Promise<ImportConfig> => {
8181 }
8282 config . apiKey =
8383 importCmdFlags [ 'stack-uid' ] || importCmdFlags [ 'stack-api-key' ] || config . target_stack || ( await askAPIKey ( ) ) ;
84- if ( typeof config . apiKey !== 'string' ) {
85- throw new Error ( 'Invalid API key received' ) ;
86- }
87- if ( ! config . apiKey || ! config . apiKey . trim ( ) ) {
88- log . debug ( 'Empty API key received!' , { apiKey : config . apiKey } ) ;
84+ if ( typeof config . apiKey !== 'string' || ! config . apiKey || ! config . apiKey . trim ( ) ) {
85+ log . debug ( 'Invalid or empty API key received!' , { apiKey : config . apiKey } ) ;
8986 throw new Error ( 'Stack API key cannot be empty. Please provide a valid stack API key.' ) ;
9087 }
9188 }
You can’t perform that action at this time.
0 commit comments