@vyriy/config
Environment config parsing utility for Vyriy projects.
Purpose
Use this package when a Vyriy project needs a small focused module for config behavior.
Vyriy packages are intentionally small. The goal is to keep the public API explicit, easy to test, and easy to compose with the rest of the Vyriy ecosystem.
Install
With npm:
npm install @vyriy/config
With Yarn:
yarn add @vyriy/config
Usage
import { getConfig, Parser } from '@vyriy/config';
const port = getConfig('PORT', 3000, Parser.int);
const debug = getConfig('DEBUG', false, Parser.boolean);
const timeout = getConfig('TIMEOUT', 5000, Parser.duration);
const features = getConfig<string[]>('FEATURES', [], Parser.csv);
Public API
The package is expected to expose the following main surface:
getConfigParserautoparseDuration from @vyriy/config/duration
Parameters and options
envName— Name of the environment variable to read.defaultValue— Optional fallback value returned when the variable is missing.parser— Parser name or parser function. Defaults to auto.Parser.boolean— Parses boolean-like values.Parser.csv— Parses comma-separated values.Parser.json— Parses JSON payloads.Parser.duration— Parses duration strings into milliseconds.
Examples
Minimal usage
import * as module from '@vyriy/config';
console.info(module);
Use inside a Vyriy package
// packages/example/index.ts
export { default as example } from '@vyriy/config';
Keep the boundary explicit
// Prefer importing from the package root unless a documented subpath is required.
import {} from /* named export */ '@vyriy/config';
Notes
- Keep configuration close to the package that owns it.
- Prefer explicit options over hidden global state.
- Keep examples small enough to copy into tests or Storybook docs.
- When adding a new public export, document it in this README and add a focused test.
Related packages
@vyriy/configfor environment-driven options.@vyriy/scriptfor readable operational flows.@vyriy/handlerand@vyriy/serverwhen the package participates in runtime handling.