@levz0r/uconfig

1.0.2 • Public • Published

uConfig

🤏 Micro Configurations Reader for Masses

  • The smallest configuration reader in the world.
  • Works with any JSON file as configuration source.
  • Has only one external dependency.

Getting Started

Install uConfig using npm:

npm i uconfig

Usage

Create a JSON file which will hold your configuration.

For example:

{
    "DB": {
        "USERNAME": "user",
        "PASSWORD": "password"
    },
    "API": {
        "ENDPOINT": "http://example.com"
    }
}

Initialize uConfig instance:

const uConfig = require("@levz0r/uconfig").default;

const config = new uConfig(/* Path to configuration JSON */);

Read configuration value:

config.get("DB.USERNAME")

Fallback value:

config.get("DB.PORT", 27017)

Package Sidebar

Install

npm i @levz0r/uconfig

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

3.12 kB

Total Files

4

Last publish

Collaborators

  • levz0r