
Security News
pnpm 12’s Rust Rewrite Cuts Install Times by Up to 90%
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.
@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
Unknown package
The npm package @edirect/config receives a total of 439 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.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.

Research
/Security News
Thirteen malicious Packagist themes expose visitors on unpatched iPhones to a WebKit-to-kernel exploit chain that steals device data and wallet seeds.