GithubHelp home page GithubHelp logo

indrajithbandara / configuration-manager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kreshnik/configuration-manager

0.0 1.0 0.0 5 KB

Laravel inspired configuration manager for NodeJS

License: MIT License

JavaScript 100.00%

configuration-manager's Introduction

configuration-man

A node module, inspired by Laravel's configuration class.

The module expects a folder called config within your application root (can be changed). It looks for .json files, which represent configuration files.

Example:

  1. config/app.json
  2. config/services.json
  3. config/auth.json
  4. config/database.json
  5. config/mail.json

Install

$ npm install --save configuration-man

Include the module

const config = require('configuration-man')();

Options

You can pass the following options object to the configuration-man.

Properties

basePath -> The application root folder.

configPath -> The folder that contains the configuration files.

const config = require('configuration-man')({
    basePath: path.dirname(__filename),
    configPath: "/config/"
});

Methods

You can use the following methods with the module.

Determine if the given configuration value exists. (Note: The first word before the dot, is the json file name.)

config.has('app.env') -> Check if the configuration file app.js has a property called env.

Get the specified configuration value. (Note: The first word before the dot, is the json file name.)

config.get('app.env') -> Get the property env from the configuration file app.js.

Set a given configuration value. (Note: The first word before the dot, is the json file name.)

config.set('app.env', 'Production') -> Set the property env to Production in the configuration file app.js.

Running tests

To run test cases, execute npm test within the module folder.

License

MIT

configuration-manager's People

Contributors

kreshnik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.