Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
/ config-man Public archive
forked from Fjandin/config-man

NodeJS configuration manager

License

Notifications You must be signed in to change notification settings

pleo-io/config-man

 
 

Repository files navigation

⚠️ This repository was archived automatically since no ownership was defined ⚠️

For details on how to claim stewardship of this repository see:

How to configure a service in OpsLevel

To learn more about the automatic process for stewardship which archived this repository see:

Automatic process for stewardship

NodeJS Configuration Manager

Install

yarn add @pleo-io/config-man

Initialize

Add [ProjectRoot]/config-man.json file

{
    "schema": [{"key": "server.port", "type": "number", "default": 8080, "nullable": false}]
}
import * as configMan from '@pleo-io/config-man'

configMan.init({
    cwd: __dirname,
    removeUnknown: true,
    configs: [
        {type: configMan.ConfigType.DEFAULT},
        {type: configMan.ConfigType.DYNAMODB, tableName: 'Configuration-Table', region: 'eu-west-1'},
        {type: configMan.ConfigType.JAVASCRIPT, filepath: path.resolve('config.js')},
        {type: configMan.ConfigType.JSON, filepath: path.resolve('config.json')},
        {type: configMan.ConfigType.ARG, prefix: 'CM_'},
        {type: configMan.ConfigType.ENV, prefix: 'CM_},
    ]
});

async function startApp() {
    // Wait for config to be ready
    await configMan.ready;

    const port = configMan.get('server.port');
    // etc...
}

About

NodeJS configuration manager

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • TypeScript 93.1%
  • JavaScript 6.9%