@mudah-cli/config
v0.9.4
Published
Typed configuration repository, .env loading, and dotted-key access.
Maintainers
Readme
@mudah-cli/config
Typed configuration repository, .env loading, and dotted-key access.
Part of Mudah — an ergonomic, animation-rich CLI framework. No Mudah dependencies; usable standalone.
Install
npm install @mudah-cli/configUsage
import { defineConfig, env, s } from '@mudah-cli/config';
export default defineConfig(
s.object({
url: s.string(),
pool: s.number().min(1).default(5),
}),
{
url: env('DATABASE_URL', 'sqlite:///local.db'),
pool: env('DB_POOL', 5),
},
);Pass a schema as the first argument and a bad value fails at import with every offending key
listed. get('db.pool') reads dotted keys; mergeConfigFrom merges defaults under existing
values (existing wins). .env loading is native (process.loadEnvFile) with typed parsing in
env().
