validateEnvVariable() — astro Function Reference
Architecture documentation for the validateEnvVariable() function in validators.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 7defd900_fe4f_9186_7d79_276a00008760["validateEnvVariable()"] 507d4b59_27b6_fc34_cbc8_02ec1d1596e5["validators.ts"] 7defd900_fe4f_9186_7d79_276a00008760 -->|defined in| 507d4b59_27b6_fc34_cbc8_02ec1d1596e5 9f0736b8_fe2c_7232_075d_3effa18267d9["selectValidator()"] 7defd900_fe4f_9186_7d79_276a00008760 -->|calls| 9f0736b8_fe2c_7232_075d_3effa18267d9 style 7defd900_fe4f_9186_7d79_276a00008760 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/env/validators.ts lines 160–179
export function validateEnvVariable(
value: string | undefined,
options: EnvFieldType,
): ValidationResult {
const isOptional = options.optional || options.default !== undefined;
if (isOptional && value === undefined) {
return {
ok: true,
value: options.default,
};
}
if (!isOptional && value === undefined) {
return {
ok: false,
errors: ['missing'],
};
}
return selectValidator(options)(value);
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does validateEnvVariable() do?
validateEnvVariable() is a function in the astro codebase, defined in packages/astro/src/env/validators.ts.
Where is validateEnvVariable() defined?
validateEnvVariable() is defined in packages/astro/src/env/validators.ts at line 160.
What does validateEnvVariable() call?
validateEnvVariable() calls 1 function(s): selectValidator.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free