Runtime services providing env and, for files, fs
Optionaloptions: ConfigPluginOptions
Loading, expansion, validation, and instance options
The configuration snapshot
import { createRuntimeServices } from '@setu-ts/runtime';
import { loadConfig } from '@setu-ts/config-plugin';
const config = await loadConfig(createRuntimeServices(), {
envFilePath: ['.env.local', '.env'],
});
const port = config.get<number>('PORT', { default: 3000 });
Builds an immutable configuration snapshot from the environment.
Sources are merged (runtime environment over
.envfiles),${NAME}references are expanded unless disabled, and a supplied schema validates and coerces the result — in that order, so references observe final values and the schema sees expanded ones.Supplying
ConfigPluginOptions.instanceshort-circuits all of that and returns the given snapshot, which is what lets an application load configuration once and hand the same object to the plugin.