โš’๐—” ๐˜‚๐—ป๐—ถ๐—ณ๐—ผ๐—ฟ๐—บ ๐—ฎ๐—ป๐—ฑ ๐—ฒ๐—น๐—ฒ๐—ด๐—ฎ๐—ป๐˜ ๐˜„๐—ฎ๐˜† ๐˜๐—ผ ๐—บ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ ๐—บ๐˜‚๐—น๐˜๐—ถ-๐—ฒ๐—ป๐˜ƒ๐—ถ๐—ฟ๐—ผ๐—ป๐—บ๐—ฒ๐—ป๐˜ ๐—ป๐—ฎ๐˜๐—ถ๐˜ƒ๐—ฒ ๐˜„๐—ฒ๐—ฏ ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commitโ€ฆ
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
configurations
scripts
.eslintignore
.eslintrc.js
.gitignore
LICENSE
README.md
index.js
index.spec.js
package.json
yarn.lock

README.md

Config Butler ๐Ÿ•ด

Introduction

A uniform and elegant way to manage multi-environment native web config files

An easy way to manage native web config files in a purposeful, modularised and uniform manner.

This set up allows for a centralised way of managing web configuration, keep things clean and trackable across multiple environments. A modern approach toward configuration which promote sound development practices and allow business logics to remain in the centre.

Installation:

npm install config-butler 

Usage

  1. Create a new configuration template in your project's configuration folder with the following format
// e.g: configurations/appConfig.js

module.exports = {
  appConfig: {
    topBanner: {
      disclaimer: {
        dev: 'this project is open source and will never ask for your money ',
        prod: 'this project is open source and will never ask for your money',
      }
    }
  }
};
  1. Create a config-files.json (you can name it however you like) in the same folder, then add a new entry as the same name of the config file created.
// configurations/config-files.json
[  
  "appConfig"
]

That's it! Simple isn't it? ๐Ÿฐ

  1. Now, before your project is built, add an entry to compile your config like follow
$ config-compile  'configurations' 'dev prod' 'Dev Production' 
                        $1             $2            $3 

# $1: Configs location 
# $2: Environments to compile 
# $3: Folders to return configuration files on 

The end result is the compiler will compile a corresponding configuration.js file to each specified environment like follow

// Dev/configuration.js 

window.sample = "https://dev.butlerio.com.au"
window.logServer = "https://dev.butlerio-logs.com.au"
window.apiSocket = "https://dev.api.butlerio.com.au"

๐Ÿป๐Ÿป๐Ÿป

Notes

Arrays are considered the last object in a config, reason being arrays might be of different sizes for each environment. This means each environment must have their own array

"availableCurrencies": {
      "dev": [
        "AUD",
        "USD",
        "EUR",
      ],
      "prod": [
        "USD"
      ]
    }

Copyright and license

Code and documentation copyright 2018 @coffeemood. Code released under the MIT License.