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

rdconfig

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdconfig

rdconfig - unified configuration for node apps, based on lorenwest/node-config

  • 1.4.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

rdconfig

define your environment on special config file

.env

ENV_NAME
CRYPT_KEY

all configs for each environment may be stored at {ENV_NAME}.json files

define instance specific connfig file

.env

ENV_NAME;INSTANCE_NAME
CRYPT_KEY

all configs for each instance may be stored at {ENV_NAME}-{INSTANCE_NAME}.json files

Note: {ENV_NAME}.json config value has more priority that {ENV_NAME}-{INSTANCE_NAME}.json

crypt your configs values

config/test.json

{
    "test1": "--crypted--7136fef387",
    "test2": "--crypted--7136fef384",
    "test3": "--crypted--7136fef385",
    "testObj": {
        "test1": "--crypted--7136fef387",
        "test2": "--crypted--7136fef384",
        "test2": "--crypted--7136fef385"
    },
    "integer": 5,
    "bool": true,
    "array": [34, 34, "test", "--crypted--7136fef385"],
    "mixedObject": {
        "test1": "--crypted--7136fef387",
        "test2": "--crypted--7136fef384",
        "test2": "--crypted--7136fef385",
        "integer": 5,
        "bool": true,
        "array": [34, 34, "test", "--crypted--7136fef385"]
    }
}

.env

test
STr0nG_CrYpT_KeY

main.js

config = require("rdconfig");

console.log(config.get("test1"));
console.log(config.get("test2"));
console.log(config.get("test3"));

console.log(config.get("testObj"));

console.log(config.get("integer"));
console.log(config.get("bool"));
console.log(config.get("array"));

console.log(config.get("mixedObject"));

output:

test1
test2
test3
{ test1: 'test1', test2: 'test2', test3: 'test3' }
5
true
[ 34, 34, 'test', 'test3' ]
{ test1: 'test1',
  test2: 'test3',
  integer: 5,
  bool: true,
  array: [ 34, 34, 'test', 'test3' ] }

Variable substitution

Configuration values (strings that are requested using rdconfig get method) can contain environment variables.

${VARIABLE} syntax is supported. Extended shell-style features, such as ${VARIABLE-default} and ${VARIABLE/foo/bar}, are not supported.

Notes

this package is based on lorenwest/node-config package and depends on it

Keywords

FAQs

Package last updated on 05 Jan 2022

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