@collection-nest/environment
TypeScript icon, indicating that this package has built-in type declarations

0.7.3 • Public • Published

@nest-collection/environment

Wrapper around @nestjs/config so that we can have more control over environment variables and project configuration in general.

Install

yarn add @collection-nest/environment

Example

const nodeEnvToPath = {
  production: '.env.production',
  development: '.env.development',
}

const NODE_ENV = process.env.NODE_ENV as keyof typeof nodeEnvToPath

// Optional
const validationSchema = Joi.object({
  NODE_ENV: Joi.string().valid('development', 'production').required(),
  PORT: Joi.number().default(3000),
})

const envFilePath = nodeEnvToPath[NODE_ENV]

EnvironmentModule.register({
  envFilePath,
  validationSchema,
})

Readme

Keywords

none

Package Sidebar

Install

npm i @collection-nest/environment

Weekly Downloads

1

Version

0.7.3

License

MIT

Unpacked Size

597 kB

Total Files

6

Last publish

Collaborators

  • michal.jarnot