Jan. 4, 2024, 2:24 p.m. | Taehyuk Han

DEV Community dev.to




Preview



  • Strongly Typed argument(property path) for Nested Configuration Object




  • Dynamic return type according to config variables







Introduction


In NestJS, ConfigModule with ConfigService helps store and load configuration variables in .env file for convenience instead of using process.env.


Using the standard constructor injection, loading the variables with ConfigService would be like:



// config/configuration.ts
export default () => ({
port: parseInt(process.env.PORT, 10) || 3000,
database: {
host: process. …

argument configuration convenience default dynamic env export file injection introduction nested nestjs object path preview process property return standard store

SOC 2 Manager, Audit and Certification

@ Deloitte | US and CA Multiple Locations

Information Security Engineer - Vulnerability Management

@ Starling Bank | Southampton, England, United Kingdom

Manager Cybersecurity

@ Sia Partners | Rotterdam, Netherlands

Compliance Analyst

@ SiteMinder | Manila

Information System Security Engineer (ISSE)-Level 3, OS&CI Job #447

@ Allen Integrated Solutions | Chantilly, Virginia, United States

Enterprise Cyber Security Analyst – Advisory and Consulting

@ Ford Motor Company | Mexico City, MEX, Mexico