Giter VIP home page Giter VIP logo

node-config-sets's Introduction

node-config-sets

A node configuration set module

AWS KMS Support

You can encrypt your config if you provide a kms_key_id and kms_region in your json config file.

{
    "kms_key_id":"11111-22222....",
    "kms_region": "us-west-2",
    "username": "bob",
    "password": "foobar",
    "db": {
        "host": "db.example.com",
        "user": "app_user",
        "password": "password"
    }
}

encrypt

usage:
npx config-set encrypt config/config.dev.json

This will create an encrypted version of config.dev.json called config.dev.encrypted.json

show

usage:
npx config-set show config/config.dev.encrypted.json

Prints the contents of config.dev.encrypted.json to stdout.

code initialization

Use config.wait({configSet: 'configName'}, (err) => {}) to decrypt the configuration at runtime.

const express = require('express');
const config = require('node-config-sets');

...

const configSet = process.env.NODE_ENV || 'dev';

config.wait({ configSet: configSet }, (err) => {
  if(err) {
    console.error('load config failed');
    process.exit(-1);
  } else {
    console.log('load config ok');
    const app = express();

    ...

    app.listen(port, () => console.log(`http listening on port ${config.port}`));
  }
});

node-config-sets's People

Contributors

jim-lake avatar rem7 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.