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

    0.0.17 • Public • Published

    Config Loader

    Super Easy Config Loader, used for Node.js CLI and Service More than dotenv

    Features

    • Smart Config Detect
    • Support yml, json, toml, ini, .env, .Xrc format
    • Auto load .env config
    • Add an app id is recommend

    Install

    npm install @znode/config
    # or
    yarn add @znode/config

    Usage

    import loadConfig from '@znode/config';
    
    // TODO: DEMONSTRATE API
    const config = await loadConfig();

    Feature

    if no app id specified

    • works like dotenv
    $PROJECT_DIR/.env
    $HOME/.config/.env
    /configs/.env
    /opt/configs/.env

    if app id specified

    • config file priority
    $PROJECT_DIR/myapp.yml
    $PROJECT_DIR/.myapp.yml
    $HOME/.config/myapp.yml
    $HOME/.config/.myapp.yml
    /configs/myapp.yml
    /configs/.myapp.yml
    /opt/configs/myapp.yml
    /opt/configs/.myapp.yml
    
    $PROJECT_DIR/myapp.json
    $PROJECT_DIR/.myapp.json
    $HOME/.config/myapp.json
    $HOME/.config/.myapp.json
    /configs/myapp.json
    /configs/.myapp.json
    /opt/configs/myapp.json
    /opt/configs/.myapp.json
    
    $PROJECT_DIR/myapp.toml
    $PROJECT_DIR/.myapp.toml
    $HOME/.config/myapp.toml
    $HOME/.config/.myapp.toml
    /configs/myapp.toml
    /configs/.myapp.toml
    /opt/configs/myapp.toml
    /opt/configs/.myapp.toml
    
    $PROJECT_DIR/myapp.ini
    $PROJECT_DIR/.myapp.ini
    $HOME/.config/myapp.ini
    $HOME/.config/.myapp.ini
    /configs/myapp.ini
    /configs/.myapp.ini
    /opt/configs/myapp.ini
    /opt/configs/.myapp.ini
    
    $PROJECT_DIR/.myapprc
    $HOME/.config/.myapprc
    /configs/.myapprc
    /opt/configs/.myapprc

    FAQ

    Related

    Keywords

    Install

    npm i @znode/config

    DownloadsWeekly Downloads

    147

    Version

    0.0.17

    License

    MIT

    Unpacked Size

    14.7 kB

    Total Files

    12

    Last publish

    Collaborators

    • uniquecolesmith