mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-20 08:43:44 +00:00
Add ability to specify poll interval in join command
Change-type: minor Resolves: #1432 #1697 #1670 Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
@ -57,6 +57,10 @@ export function validateDotLocalUrl(input: string): boolean {
|
||||
return DOTLOCAL_REGEX.test(input);
|
||||
}
|
||||
|
||||
export function validateLocalHostnameOrIp(input: string): boolean {
|
||||
return validateIPAddress(input) || validateDotLocalUrl(input);
|
||||
}
|
||||
|
||||
export function validateLongUuid(input: string): boolean {
|
||||
if (input.length !== 32 && input.length !== 62) {
|
||||
return false;
|
||||
@ -100,3 +104,16 @@ export function tryAsInteger(input: string): number | string {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
export function parseAsLocalHostnameOrIp(input: string, paramName?: string) {
|
||||
if (input && !validateLocalHostnameOrIp(input)) {
|
||||
const message =
|
||||
paramName == null
|
||||
? 'The parameter must be a local hostname or IP address.'
|
||||
: `The parameter '${paramName}' must be a local hostname or IP address.`;
|
||||
|
||||
throw new ExpectedError(message);
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
Reference in New Issue
Block a user