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

docker-config-loader

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

docker-config-loader

A really simple utility which loads the config from docker secrets if a specified env var is passed, if not it loads the config from a local path

  • 1.0.0
  • latest
  • npm
  • Socket score

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

docker-config-loader

A extremely basic module to load a different config based on the environment.

Docs

Base Usage:

var loader = require('docker-config-loader');
var config;
try {
    config = loader({secretName:'prod_config.json',localPath:'./local_config.json'})
} catch(e) {
    //An Error occured, maybe the config was not found or could not be required.
}

If a environment var with the name set in secretName exists, the loader prefers it over the local path and tries to load it from /run/secrets/secretName ##Local Loading The Path is relative to node_modules. For Example: if you got a project structure as follows:

- node_modules
- config.json
- src
    - index.js

The loader will use the root path of the project, so if you want to require the config.json you would have to set the following options:

loader({secretName:'prod_config.json',localPath:'./config.json'})

I hope this module is a nice utility for very basic needs like mine.

Keywords

FAQs

Package last updated on 07 Mar 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

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