1.1.0 • Published 3 years ago

@webbspark/enc-config v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

@webbspark/enc-config

Description

A tool for creating/ accessing encrypted config files. Allowing safer storage of config data in remote repositories.

Installation

npm i @webbspark/enc-start

Importing Package

  1. const { config, build } = require('@webbspark/enc-build');
  2. const config = require('@webbspark/enc-build').config;\ const build = require('@webbspark/enc-build').build;

Properties

  • config - Decrypted config data
  • build - Encrypts json files contained in the .config folder to the config folder

Use Example

.config/myconfig-local.json -

{
    "password": "simple",
    "db": {
        "host": "localhost",
        "name": "mydatabase",
        "password": "guessit",
        "user": "auser"
    }
}

index.js -

const config = require('@webbspark/enc-build').config;
const mysql = require('mysql');

const conn = mysql.createConnection({
    host: config.db.host,
    database: config.db.name,
    password: config.db.password,
    user: config.db.user
});

package.json -

{
    ...
    "scripts": {
        ...
        "build": "node -e \"require('@webbspark/enc-config').build();\""
    }
}

Run -

npm run build
CONFIG=myconfig-local_simple node index.js

Suggested .gitignore additions

.config
config/*-local

 

Feature Requests and Bug Reporting

Bug Reporting\ Feature Requests

 

License

Copyright (C) 2021 Christopher J. Webb - WebbSpark LLC.

Permission to use, and/or distribute this software for any legal purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

BY USING THIS SOFTWARE YOU AGREE TO ALL THE TERMS AND CONDITIONS HEREIN.

THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER/AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

COPYRIGHT HOLDER/AUTHOR RESERVES THE RIGHT TO CHANGE THESE TERMS AND CONDITIONS AT ANY TIME, FOR ANY REASON, WITHOUT PRIOR NOTICE.