Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cascadia

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cascadia

oppinionated cascading static config loader

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Cascadia

Cascadia is an opinionated cascading static configuration loader. It loads static configuration files such that common configuration files are loaded first, followed by a set of environment configuration files which are then optionally followed by a set of machine specific local configurations files.

Conventions

Each configuration file is simply a CommonJS module of a statically defined JSON object (module.exports = {}). Cascadia doesn't attempt to perform any clever object merging. If you have a config parameter in common and you override it with an environment specific config the entire value of the latter config will override the entire value of the prior config.

Cascadia expects the configuration directory it's reading to be laid out in a very specific way. I would make a joke about convention over configuration in a configuration loader here, but all jokes seem to elude me at the moment. In either case, the bare minimum directory structure cascadia expects is as follows.

/configs
  \_ /common
  \_ /local

However, typically you'll want to have environment specific configurations. Cascadia doesn't impose any specific environments on you and it's up to you to define your own environments in the directory structure and tell cascadia which one to use. So say you had dev, stage and prod environments, you're cascadia configuration folder may look like the following

/configs
  \_ /common
  \_ /dev
  \_ /stage
  \_ /prod
  \_ /local

cascadia(location, env = false, local = true)

This module only exports a single function cascadia(). This function takes a required location argument with optional env and local arguments. The location argument is a path to the base configuration folder. The env argument specifies the set of environment configurations to load that should corespond to the name of the folder within the base configuration folder where the environment configurations can be found. If env is false then no environment variables will be loaded. The local variable is just a toggle to enable or disable the loading of local configuration files found in the local folder

  • @param {string} location - The path to the base configuration folder
  • @param {string|boolean} env - The optional environment to load or false
  • @param {boolean} local - The toggle to load local configs
  • @returns {object} - The resulting configuation

Keywords

FAQs

Package last updated on 05 Oct 2012

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc