Default implementation of PluginContext.
Expose container as the minimal Container interface. PluginContext consumers only see the minimal interface.
Gets configuration for this plugin.
The configuration type
The plugin configuration
const config = context.getConfig<DatabaseConfig>();console.log(config.host, config.port); Copy
const config = context.getConfig<DatabaseConfig>();console.log(config.host, config.port);
Gets a service from the container if it exists.
The service type
The service name
The service instance if it exists, undefined otherwise
const metrics = context.getService<Metrics>('metrics');if (metrics) { metrics.increment('database.connections');} Copy
const metrics = context.getService<Metrics>('metrics');if (metrics) { metrics.increment('database.connections');}
Readonly
Default implementation of PluginContext.