@betsys-nestjs/config-utils
v2.0.0
Published
Simple config factory with Joi schema validation support
Downloads
27
Maintainers
Keywords
Readme
Config Utils library
Library for validating config agains Joi schema before registering it.
Dependencies
| Package | Version | | ---------------- | ------- | | @hapi/joi | ^17.0.0 | | @nestjs/common | ^10.0.0 | | @nestjs/config | ^3.0.0 | | reflect-metadata | <1.0.0 | | rxjs | ^7.0.0 |
Usage
Use provided function createFeatureConfig
instead of original reagisterAs
factory function.
The rest stays the same as before (
see @nestjs/config docs for more).
import {createFeatureConfig} from '@betsys/nestjs-config-utils';
import {ConfigModule} from '@nestjs/config';
export const featureConfig = createFeatureConfig(
'featureName',
configObjectFactory,
configJoiSchema,
);
@Module({
imports: [ConfigModule.forFeature(featureConfig)],
})
class AppModule {
}