Skip to content

Commit

Permalink
Merge branch 'feat/release-candidate' into fix/docker-labels
Browse files Browse the repository at this point in the history
  • Loading branch information
robot9706 committed Dec 12, 2024
2 parents cc18591 + c0876dd commit c486653
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions web/crux-ui/src/validations/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,30 @@ const testSecretRules = (imageLabels: Record<string, string>) => (secrets: Uniqu
return testRules(secretRules, secrets, 'secret')
}

const testEnvironmentRules = (imageLabels: Record<string, string>) => (envs: UniqueKeyValue[]) => {
const rules = parseDyrectorioEnvRules(imageLabels)
if (!rules) {
return true
}

const requiredRules = Object.entries(rules).filter(([, rule]) => rule.required)
const envRules = requiredRules.filter(([_, rule]) => !rule.secret)

return testRules(envRules, envs, 'environment')
}

const testSecretRules = (imageLabels: Record<string, string>) => (secrets: UniqueSecretKeyValue[]) => {
const rules = parseDyrectorioEnvRules(imageLabels)
if (!rules) {
return true
}

const requiredRules = Object.entries(rules).filter(([, rule]) => rule.required)
const secretRules = requiredRules.filter(([_, rule]) => rule.secret)

return testRules(secretRules, secrets, 'secret')
}

const createContainerConfigBaseSchema = (imageLabels: Record<string, string>) =>
yup.object().shape({
name: matchContainerName(yup.string().nullable().optional().label('container:common.containerName')),
Expand Down

0 comments on commit c486653

Please sign in to comment.