
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@edirect/config
Advanced tools
Global NestJS configuration module for eDirect applications. Provides environment variable loading via `dotenv` and a `ConfigService` for accessing configuration values across the application.
Global NestJS configuration module for eDirect applications. Provides environment variable loading via dotenv and a ConfigService for accessing configuration values across the application.
.{NODE_ENV}.env file automatically on startup (e.g., .development.env, .production.env)ConfigService anywhereget(key) / getConfig() APIConfigService) and string constant (CONFIG_SERVICE_TOKEN)pnpm add @edirect/config
# or
npm install @edirect/config
import { Module } from '@nestjs/common';
import { ConfigModule } from '@edirect/config';
@Module({
imports: [ConfigModule],
})
export class AppModule {}
Because ConfigModule is decorated with @Global(), you only need to import it once at the root module. ConfigService will be available for injection in all feature modules automatically.
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@edirect/config';
@Injectable()
export class MyService {
constructor(private readonly config: ConfigService) {}
doSomething() {
const dbUrl = this.config.get('DATABASE_URL');
const port = this.config.get('PORT') ?? '3000';
}
}
ConfigService| Method | Signature | Description |
|---|---|---|
constructor | (filePath?: string) | Optionally pass a .env file path. Automatically called with .{NODE_ENV}.env by the module. |
get | (key: string): string | undefined | Returns the value for the given environment variable key from process.env. |
getConfig | (): IStringMapper | Returns all environment variables as a Record<string, string>. |
CONFIG_SERVICE_TOKENAn alternative injection token (string constant) for ConfigService. Useful when you need to inject by token rather than by class:
import { Inject } from '@nestjs/common';
import { CONFIG_SERVICE_TOKEN, ConfigService } from '@edirect/config';
constructor(@Inject(CONFIG_SERVICE_TOKEN) private config: ConfigService) {}
The module automatically loads .{NODE_ENV}.env from the working directory:
NODE_ENV | File loaded |
|---|---|
development (default) | .development.env |
staging | .staging.env |
production | .production.env |
test | .test.env |
Example .development.env:
PORT=3000
DATABASE_URL=mongodb://localhost:27017/mydb
REDIS_URL=redis://localhost:6379
LOGS_LEVEL=debug
Note: Never commit
.envfiles containing sensitive credentials to version control.
export { ConfigModule } from './config/config.module';
export { ConfigService } from './config/config.service';
export { CONFIG_SERVICE_TOKEN } from './config/config.constants';
export type { IStringMapper } from './config/config.interfaces';
FAQs
Global NestJS configuration module for eDirect applications. Provides environment variable loading via `dotenv` and a `ConfigService` for accessing configuration values across the application.
The npm package @edirect/config receives a total of 256 weekly downloads. As such, @edirect/config popularity was classified as not popular.
We found that @edirect/config demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 29 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.