🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@loke/config

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loke/config

LOKE application configuration management

3.0.0
latest
Source
npm
Version published
Weekly downloads
154
0.65%
Maintainers
1
Weekly downloads
 
Created
Source

LOKE Config

Convention based configuration module using YAML for Node apps.

Paths

The configuration exposed will be created from the following paths (settings in paths higher on the list will override those lower on the list):

  • {app_path}/config.yml
  • {app_path}/config/config.yml
  • /private/etc/{app_name}/config.yml
  • /etc/{app_name}/config.yml
  • {app_path}/config/defaults.yml

However, if the process has a --config [filename] argument, then that file will be used instead.

The defaults.yml file is required, and all configuration keys must have a value listed in the defaults.yml.

YAML

Config files are defined using YAML. See http://yaml.org/

How to Use

Example defaults.yml:

server:
  hostname: www.myapp.com
  port: 80
var config = require('loke-config').create('myapp');

var hostname = config.get('server.hostname');
var port = config.get('server.port');

console.log(hostname); // www.myapp.com
console.log(port); // 80

Environment Variables

You can also override variables using environment variables. Specify them in upper case, and replace . with __ (double underscore).

eg:

SERVER__HOSTNAME=www.mynewapp.com npm start

FAQs

Package last updated on 30 Oct 2017

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