carlos-menezes / yup-schema-env

Parse environment variables with jquense/yup.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yup-schema-env

Parse environment variables with jquense/yup.

Installation

pnpm add yup-schema-env

Usage

import { object, number, string } from 'yup'
import { parseEnvironment } from 'yup-schema-env'

const schema = object().shape({
    port: number().default(3000),
    api_key: string(),
})

const env = process.env

const config = parseEnvironment(env, schema)
console.dir(config)

About

Parse environment variables with jquense/yup.

License:MIT License


Languages

Language:TypeScript 100.0%