Skip to content

Commit 9bca9e8

Browse files
Host issue reolved
1 parent 225f41a commit 9bca9e8

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • packages/contentstack-config/src/commands/config/set

packages/contentstack-config/src/commands/config/set/proxy.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { flags, configHandler, FlagInput, log, handleAndLogError } from '@contentstack/cli-utilities';
1+
import { flags, configHandler, FlagInput, log, handleAndLogError, cliux } from '@contentstack/cli-utilities';
22
import { askProxyPassword } from '../../../utils/interactive';
33
import { BaseCommand } from '../../../base-command';
44

@@ -38,15 +38,23 @@ export default class ProxySetCommand extends BaseCommand<typeof ProxySetCommand>
3838

3939
log.debug('Parsed proxy configuration flags', this.contextDetails);
4040

41+
// Validate host - must not be empty or whitespace-only
42+
if (!flags.host || flags.host.trim() === '') {
43+
log.error('Invalid host provided - host cannot be empty or whitespace-only', this.contextDetails);
44+
cliux.error('Invalid host address. Host cannot be empty or contain only whitespace.');
45+
return;
46+
}
47+
4148
const port = Number.parseInt(flags.port, 10);
4249
if (Number.isNaN(port) || port < 1 || port > 65535) {
4350
log.error('Invalid port number provided', this.contextDetails);
51+
cliux.error('Invalid port number. Port must be between 1 and 65535.');
4452
return;
4553
}
4654

4755
const proxyConfig: any = {
4856
protocol: flags.protocol || 'http',
49-
host: flags.host,
57+
host: flags.host.trim(),
5058
port: port,
5159
};
5260

0 commit comments

Comments
 (0)