Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the max length for domain name validation #716

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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