@neuledge/env
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.0-alpha.180alpha
1.0.01latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.01
1.0.0-alpha.190
1.0.0-alpha.180

Package Sidebar

Install

npm i @neuledge/env

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

12 kB

Total Files

28

Last publish

Collaborators

  • moshe