0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00
astro/.changeset/red-rings-tell.md
2024-06-10 13:40:56 +02:00

895 B

astro
patch

Adds additional validation options to astro:env

astro:env schema datatypes string and number now have new optional validation rules:

import { defineConfig, envField } from 'astro/config'

export default defineConfig({
    experimental: {
        env: {
            schema: {
                FOO: envField.string({
                    // ...
                    max: 32,
                    min: 3,
                    length: 12,
                    url: true,
                    includes: 'foo',
                    startsWith: 'bar',
                    endsWith: 'baz'
                }),
                BAR: envField.number({
                    // ...
                    gt: 2,
                    min: 3,
                    lt: 10,
                    max: 9,
                    int: true
                })
            }
        }
    }
})