New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

c0nfig

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

c0nfig

require local configs as if it's node_modules

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

c0nfig

npm version Dependency Status

Require local environment based configs as if they are in node_modules.

Install

npm install c0nfig --save

Usage

Create configs for every app environment just putting the env name as prefix of the file name:

app-folder/config:~$ ls -a

production.config.js
development.config.js
# etc.

Export some configuration data for every environment like:

// config/development.config.js
module.exports = {
  title: 'BLITZKRIEG BOP (STAGING)',
  apiUrl: 'https://staging.example.org/api'
};
// config/production.config.js
module.exports = {
  title: 'BLITZKRIEG BOP (PRODUCTION)',
  apiUrl: 'https://example.org/api'
};

Start your app with proper NODE_ENV (if not provided it will grab development.config.js by default), then require/import c0nfig in your source code and use the data:

// src/app.js
import config from 'c0nfig';
import request from 'superagent';

request.get(config.apiUrl).then(res => { ... });
// src/app.js
const config = require('c0nfig');
const request = require('superagent');

request.get(config.apiUrl).then(res => { ... });

Template tags

You are able to use template tags like $(configProperty.childProperty) to point to specific properties of config:

module.exports = {
  title: 'BLITZKRIEG BOP!',
  http: {
    port: process.env.PORT || 8080,
    url: process.env.URL || 'http://0.0.0.0:$(http.port)'
  }
};

MIT Licensed

Keywords

FAQs

Package last updated on 31 Oct 2018

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