Configurator
Loads all yaml files under config
directory in the root folder, validates them against a schema, and then returns them if they're valid. Otherwise logs an error and exits the process with error code 1.
Schema
Schema validation currently supports the following values:
- Objects
- Arrays
- Numbers
- Strings
- Booleans
Example
import { parse, schema } from 'configurator'
const parsed = parse(schema.object({
config: schema.object({
PORT: schema.number(),
}),
secrets: schema.object({
MONGO_URL: schema.string(),
}),
}))
console.log(parsed)