Non-Printable Material

    @plastdev/config
    TypeScript icon, indicating that this package has built-in type declarations

    1.6.2 • Public • Published

    config

    Simple Config with ENV Support.

    Installation

    • npm install --save @plastdev/config

    Usage

    const Config = require('@plastdev/config')
    let config = new Config()

    Then config is your config object. (Use it like config.setting)

    It reads from the following sources, performing a deep merge:
    (The Top Value overwrites the lower ones)

    • ENV
    • config.json
    • config.defaults.json

    Enviroment Variables can target deep nested settings:
    The Setting setting.deep.key can be reached with SETTING_DEEP_KEY

    You may use the function reload() to reload the config from all sources.
    `config.reload()``

    This makes reload a reserved keyword

    Examples

    Only config.defaults.json

    node examples/only-defaults/index.js

    Only config.json

    (Kind of legacy use)

    node examples/only-local/index.js

    defaults and config.json

    node examples/defaults-overwrite/index.js

    enviroment variables

    (Enviroment set by command to not pollute your machine)

    SETTING=overwritten-by-env node examples/env/index.js

    Keywords

    Install

    npm i @plastdev/config

    DownloadsWeekly Downloads

    16

    Version

    1.6.2

    License

    ISC

    Unpacked Size

    248 kB

    Total Files

    44

    Last publish

    Collaborators

    • sigmundd