1.0.0 • Published 9 months ago

@neuledge/env v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Environment variables

This package provides a simple way to access environment variables both in the browser and in Node.js. It also provides a way to validate environment variables.

Install

Install the package:

yarn add @neuledge/env

Usage

Accessing environment variables

import { env } from '@neuledge/env';

const port = env.PORT;

Validating environment variables

import { env, bool } from '@neuledge/env';

const isProduction = bool(env.IS_PRODUCTION);

Setting environment variables

We allow extending the env file before reading it using:

import { env } from '@neuledge/env/root';

Object.extend(env, { ... });

This is useful when you need to set environment variables in browser environments and then load the updated env variable separately via:

import { env } from '@neuledge/env/browser';

For more details, see Next.js Runtime Configuration.

1.0.0

9 months ago

1.0.0-alpha.19

9 months ago

1.0.0-alpha.18

10 months ago