nest-profiler-config
Types and API of the configuration snapshot collector.
ConfigCollectorModuleOptions
Options passed to ConfigCollectorModule.forRoot().
Prop
Type
Automatic masking
Keys matching /password|secret|key|token|credential|api_key|apikey/i are replaced with ***. Additional keys can be specified via maskKeys (exact match or dot-notation path, e.g. 'database.password').
What is captured
The collector reads ConfigService.internalConfig - the merged output of every namespace registered with registerAs, whether passed to ConfigModule.forRoot({ load }) or ConfigModule.forFeature(). It does not read process.env directly.
Each top-level namespace becomes its own group in the panel (keys shown relative to the namespace); top-level scalar values are gathered under a General group. Grouping is structural — @nestjs/config merges forRoot and forFeature config into the same store, so a namespace's origin is not distinguished.
Prerequisite: at least one namespace must be registered with registerAs, either via ConfigModule.forRoot({ isGlobal: true, load: [factory1, factory2] }) or ConfigModule.forFeature(factory). Without any loaded config, internalConfig is empty and nothing is captured.
// Required setup - config factory
import { registerAs } from '@nestjs/config';
export default registerAs('database', () => ({
host: process.env.DATABASE_HOST,
password: process.env.DATABASE_PASSWORD, // auto-masked in the panel
}));Public exports
import { ConfigCollectorModule } from '@eleven-labs/nest-profiler-config';
import { ConfigCollector } from '@eleven-labs/nest-profiler-config';
import type {
ConfigCollectorModuleOptions,
ConfigCollectorModuleAsyncOptions,
} from '@eleven-labs/nest-profiler-config';Setup
ConfigModule stays in your production AppModule; the collector goes in the dev-only profiling bundle:
import { Module } from '@nestjs/common';
import { ProfilerModule } from '@eleven-labs/nest-profiler';
import { ConfigCollectorModule } from '@eleven-labs/nest-profiler-config';
@Module({
imports: [
ProfilerModule.forRoot({ isGlobal: true }),
ConfigCollectorModule.forRoot({ maskKeys: ['database.password', 'jwt.secret'] }),
],
})
export class ProfilingModule {}
ProfilingModuleis the dev-only bundle loaded bymain-dev.ts— see Enabling and disabling the profiler. If the profiler is installed as a production dependency behind the runtime gate, wrap the same call inConditionalModule.registerWhen(..., isProfilerEnabled).
Async setup
Drive the options from ConfigService (or any provider) with forRootAsync(), added to the dev-only bundle's imports in place of forRoot(). It resolves option values only — for the enabled flag and when to prefer forRoot, see Enabling and disabling the profiler.
import { ConfigService } from '@nestjs/config';
import { ConfigCollectorModule } from '@eleven-labs/nest-profiler-config';
ConfigCollectorModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
maskKeys: config.get<string[]>('profiler.maskKeys') ?? ['database.password', 'jwt.secret'],
}),
});