@impargo/configurator
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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)
// {
//   config: {
//     port: 123
//   },
//   secrets: {
//     MONGO_URL: "mongodb://server.mongodb.net/db"
//   }
// }

Readme

Keywords

none

Package Sidebar

Install

npm i @impargo/configurator

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

12.2 kB

Total Files

25

Last publish

Collaborators

  • impargo_sayegh
  • sayegh
  • khaledsakr
  • antoineraouimpargo
  • jlabeit