blob: e450038ebd90cd0e5d8695894c0d6dd7a26b1377 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import type { GetEnv } from 'astro/env/setup';
export const createGetEnv =
(env: Record<string, unknown>): GetEnv =>
(key) => {
const v = env[key];
if (typeof v === 'undefined' || typeof v === 'string') {
return v;
}
if (typeof v === 'boolean' || typeof v === 'number') {
// let astro:env handle the validation and transformation
return v.toString();
}
return undefined;
};
|