modules icon indicating copy to clipboard operation
modules copied to clipboard

Add `nuxt-envalid`

Open manuelhenke opened this issue 1 year ago • 3 comments

Add nuxt-envalid

Description

This a dead simple wrapper module for the library envalid which validates your environment variables, provides default values and inject them to where you want. This module stores them back to process.env and options.env. It can go hand in hand with @nuxtjs/dotenv.

Repository

https://github.com/manuelhenke/nuxt-envalid

npm

https://www.npmjs.com/package/nuxt-envalid

Definitions

name: nuxt-envalid
description: Validates your env variables and loads them cleaned into your application context
repo: manuelhenke/nuxt-envalid
npm: 'nuxt-envalid'
github: https://github.com/manuelhenke/nuxt-envalid
website: https://nuxt-envalid.henkebyte.com/
learn_more: https://www.npmjs.com/package/nuxt-envalid
category: Extensions
type: 3rd-party
maintainers:
  - name: Manuel Henke
    github: manuelhenke
compatibility:
  nuxt: ^2.0.0
  requires: {}

manuelhenke avatar Aug 13 '22 17:08 manuelhenke

Thank you for your contribution, actually we recommend as much as possible to avoid depending on @nuxtjs/dotenv, have you read https://nuxtjs.org/tutorials/moving-from-nuxtjs-dotenv-to-runtime-config ?

Atinux avatar Aug 22 '22 16:08 Atinux

Thank you for your feedback.

It's not depending on @nuxtjs/dotenv, but it can be used together. You are good to go to only use the env property of the Nuxt config.

I am aware of the new environment variables handling in Nuxt 3. Currently this module only supports Nuxt 2, but I'v created an issue to add Nuxt 3 compability: https://github.com/manuelhenke/nuxt-envalid/issues/20

manuelhenke avatar Aug 23 '22 00:08 manuelhenke

I really love your idea @manuelhenke <3 Wondering if we can somehow integrate envalid with default Nuxt env loading stack in https://github.com/unjs/c12

pi0 avatar Aug 23 '22 08:08 pi0