ConfigPlugin(options?: ConfigPluginOptions): IPlugin
Creates the ConfigPlugin.
The plugin depends on the runtime plugin (CAPABILITIES.RUNTIME) and
registers its IConfig under CAPABILITIES.CONFIG at
PLUGIN_PRIORITY.HIGH (100) so configuration is available before
most other plugins register.
Registration may be async because env files are loaded asynchronously
through runtime.fs.
Example 1
Example 1
import { ConfigPlugin } from '@setu-ts/config-plugin'; import { z } from 'npm:zod'; const AppConfigSchema = z.object({ PORT: z.coerce.number().default(3000), DATABASE_URL: z.string().url(), }); app.register(ConfigPlugin({ envFilePath: ['.env.local', '.env'], validationSchema: AppConfigSchema, expandVariables: true, }));
optional
options: ConfigPluginOptions
Plugin configuration