Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 2.03 KB

File metadata and controls

69 lines (50 loc) · 2.03 KB

Nest Typed Config Extended

License Current Version npm

Extends the default dotenv-loader and module provided by nest-typed-config NPM package.

Installation

yarn add nest-typed-config-extended

Usage

import { TypedConfigModuleExtended, dotenvLoaderExtended } from 'nest-typed-config-extended';

import { Config } from './common/config';

@Module({
  imports: [
    TypedConfigModuleExtended.forRoot({
      isGlobal: true,
      load: dotenvLoaderExtended({
        envFilePath: ['.env'],
        separator: '__',
        transformFromUpperSnakeCase: true,
      }),
      schema: Config,
    }),
  ],
})
export class MainModule {}

Options

transformFromUpperSnakeCase

If set to to true an .env file that contains UPPER_SNAKE_CASE variables, e.g. NODE_ENV, will be transformed to the camelCase equivalent, e.g. nodeEnv. This works for shallow and deeply nested objects.

License

MIT License

Contributing

Contributions are encouraged, please see further details below:

Pull Requests

Here are some basic rules to follow to ensure timely addition of your request:

  1. Match coding style (braces, spacing, etc.).
  2. If it is a feature, bugfix, or anything please only change the minimum amount of code required to satisfy the change.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge.
  4. Pull requests must be made against the main branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Check for existing issues first, before filing a new issue.