Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@janiscommerce/settings

janis-commerce9.6kISC1.0.1

readme

settings

Build Status Coverage Status

Installation

npm install @janiscommerce/settings

API

Settings.get(string) static

  • This method returns settings or settings by key. Example: Settings.get(); Example: Settings.get('database');

Setting file

The setting file is a JSON with all the settings.

It's located in path/to/root/[MS_PATH]/config/.janiscommercerc.json.

[MS_PATH] : ENV variable. Default is empty.

Example

{
    "database": {
        "core": {
            "host": "my-host",
            "user": "the-user"
        },
        "otherConn": {
            "host": "my-other-host",
            "user": "other-user"
        }
    },
    "otherConfig": 123,
    "mainPath": "/main/path/"
}

Usage

How to get settings

const Settings = require('janiscommerce/settings');

const settings = Settings.get();

How to get settings by key

const Settings = require('janiscommerce/settings');

const settings = Settings.get('database');

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[1.0.1] - 2019-07-17

Changed

  • path for .janniscommercerc.json, to [MS_PATH]/config

[1.0.0] - 2019-07-04

Added

  • README
  • tests
  • Settings module with get method and internal cache