Socket
Socket
Sign inDemoInstall

fs-settings-loader

Package Overview
Dependencies
6
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fs-settings-loader

config loader


Version published
Weekly downloads
3
increased by50%
Maintainers
1
Install size
962 kB
Created
Weekly downloads
 

Readme

Source

fs-settings-loader

npm i fs-settings-loader
var loader = require('fs-settings-loader')
var settings = loader('./configs/dev.json')

parent

Config files may overlap. To do this, you must specify the path to a parent file:

//bundle.global.json
{
    "logger": { "Console": { "level": "info" } },
    "firstAppPort": 8080,
    "secondAppPort": 8081
}

//bundle.firstApp.json
{
    "__parent__": "./bundle.global",
    "scanInterval": "t{ 10 minutes }",
    "secondAppAddress": "http://locahost:#{ secondAppPort }"
}

stacking order: bundle.global.json < bundle.firstApp.json

default

Multiple config files can have a common default file, eg:

//app.default.json
{
    "insertTemplate": "INSERT table_name SET ?"
}
//app.dev.json
{
    "db": { "host": "localhost" }
}
//app.prod.json
{
    "db": { "host": "server-address" }
}

stacking order: app.default.json < app.dev.json
stacking order: app.default.json < app.prod.json

local

Each configuration file, other than the default file, can have a local configuration file:

//app.default.json
{
    "delayBeforeStart": "t{ 10 seconds }",
    "delayBeforeStop": "t{ 10 seconds }",
    "pingInterval": "t{ 10 seconds }",
    "initProblemTimeout": "t{ 60 seconds }",

    "minIntervalOfPlannedRestart": "t{ 1 hour  }",
    "maxIntervalOfPlannedRestart": "t{ 2 hours }"
}

//app.dev.json
{
    "startCmd": "notify-send 'startCmd - google-chrome'",
    "stopCmd": "notify-send 'stopCmd - killall chrome'"
}
//app.dev.local.json
{
    "minIntervalOfPlannedRestart": "t{ 15 seconds }",
    "maxIntervalOfPlannedRestart": "t{ 16 seconds }"
}

stacking order: app.default.json < app.dev.json < app.dev.local.json

interpolation

properties interpolation:

{
    "port": 8080,
    "address": "http://locahost:#{ port }"
} 

convert human-readeble time intervals to milliseconds:

{
    "interval": "t{ 1 hour }"
}

resolve paths by cwd:

{
    "cwd": "p{ ./ }"
}

exec functins:

{
    "prop": "some data",
    "propLength": "@{ this.prop.length }"
}

interpolation order: functions < paths < time < properties

Keywords

FAQs

Last updated on 23 Aug 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc