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
// In AppModule (alongside ConfigModule):
import { ConditionalModule } from '@nestjs/config';
const isProfilerEnabled = (env: NodeJS.ProcessEnv) => env['PROFILER_ENABLED'] === 'true';
ConditionalModule.registerWhen(
ConfigCollectorModule.forRoot({ maskKeys: ['database.password', 'jwt.secret'] }),
isProfilerEnabled,
);Async setup
Drive the options from ConfigService (or any provider) with forRootAsync(), gated per environment with ConditionalModule (recommended). It resolves option values only — for the enabled flag and when to prefer forRoot, see Enabling and disabling the profiler.
import { ConditionalModule, ConfigService } from '@nestjs/config';
import { ConfigCollectorModule } from '@eleven-labs/nest-profiler-config';
const isProfilerEnabled = (env: NodeJS.ProcessEnv) => env['PROFILER_ENABLED'] === 'true';
ConditionalModule.registerWhen(
ConfigCollectorModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
maskKeys: config.get<string[]>('profiler.maskKeys') ?? ['database.password', 'jwt.secret'],
}),
}),
isProfilerEnabled,
);