2022-06-01 04:28:31 +00:00
|
|
|
import { object, boolean, string } from 'yup';
|
|
|
|
|
|
|
|
import { validation as nomadTokenValidation } from './NomadTokenField';
|
|
|
|
|
|
|
|
export function validationSchema(isNomadTokenVisible?: boolean) {
|
|
|
|
return object().shape({
|
|
|
|
allowSelfSignedCertificates: boolean(),
|
|
|
|
envVars: string(),
|
2022-11-21 07:51:55 +00:00
|
|
|
...nomadValidation(isNomadTokenVisible),
|
2022-06-01 04:28:31 +00:00
|
|
|
});
|
|
|
|
}
|
2022-11-21 07:51:55 +00:00
|
|
|
|
|
|
|
function nomadValidation(isNomadTokenVisible?: boolean) {
|
|
|
|
if (!isNomadTokenVisible) {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
tlsEnabled: boolean().default(false),
|
|
|
|
...nomadTokenValidation(),
|
|
|
|
};
|
|
|
|
}
|