Skip to content

Commit

Permalink
Increase the max length for domain name validation
Browse files Browse the repository at this point in the history
  • Loading branch information
2can committed Dec 22, 2023
1 parent b443749 commit ca9f818
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
7 changes: 3 additions & 4 deletions src/cli/env/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
contentBox,
formatConfirm,
obfuscateArgv,
println,
SaleorEnvironmentError,
validateLength,
waitForTask,
Expand Down Expand Up @@ -250,9 +251,7 @@ const getDomain = async (
return chalk.red(errorMsg);
}

validateLength(value, 40);

return true;
return validateLength(value, 100);
},
});

Expand Down Expand Up @@ -282,7 +281,7 @@ const validateDomain = async (
for (const [errorMsg] of Object.values(errors)) {
switch (errorMsg) {
case 'environment with this domain label already exists.': {
console.log(chalk.red(msg));
println(chalk.red(msg));
domain = await getDomain(argv, name, msg, json.domain_label);
json.domain_label = domain;
break;
Expand Down
13 changes: 4 additions & 9 deletions src/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,7 @@ export const validateLength = (
}

if (value.length > maxLength) {
console.log(
chalk.red(`${name} please use ${maxLength} characters maximum`),
);
return false;
return chalk.red(`${name} please use ${maxLength} characters maximum`);
}

return true;
Expand All @@ -534,17 +531,15 @@ export const validateEmail = (

const re = /\S+@\S+\.\S+/;
if (!re.test(value)) {
console.log(chalk.red('please provide valid email'));
return false;
return chalk.red('please provide valid email');
}

return true;
};

export const validatePresence = (value: string): boolean => {
export const validatePresence = (value: string) => {
if (value.length < 1) {
console.log(chalk.red('please provide value'));
return false;
return chalk.red('please provide value');
}

return true;
Expand Down

0 comments on commit ca9f818

Please sign in to comment.