(raw: Record<string, unknown>)
| 803 | ]; |
| 804 | |
| 805 | const formatSchemaErrors = (raw: Record<string, unknown>): string[] => { |
| 806 | const errors: string[] = []; |
| 807 | |
| 808 | for (const error of Value.Errors(envSchema, raw)) { |
| 809 | const stripped = error.path.replace(/^\//, ""); |
| 810 | const key = stripped === "" ? "<root>" : stripped; |
| 811 | |
| 812 | errors.push(`${key}: ${error.message}`); |
| 813 | } |
| 814 | |
| 815 | return errors; |
| 816 | }; |
| 817 | |
| 818 | export const validateEnv = (source: EnvSource = process.env): Env => { |
| 819 | const raw = readRaw(source); |