1.1.4 • Published 7 years ago

goenv v1.1.4

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

Introduction

A set of tools to get env files and save

Start

  • Install
npm i goenv --save
  • Use
const goenv = require('goenv');

const options = 
{
        global: true,
        process: true,
        dirname: __dirname,
        defaultEnv:'dev',
        envName: 'nodeRocks-1.0',
        envPatterns:['dev','int','pre', 'pro'],
        types:['json','js'],
        excludeFiles:['package.json','index.js'],
        excludeFolders:['node_modules']
};

const env = goenv.init(options);

OPTIONS FOR INIT METHOD - example:

Global var env

Get the env context in other files after call goenv in index app.

const env = global[myEnvNameInstance];

Extend env

const goenv = require('goenv');
 
const optionsExtend = 
{
global: true,
process: true,
envName: 'nodeRocks-1.0'
};

const extended = goenv.extend({
	propertyExtended: {
		property: 'extended'
	}
}, optionsExtend);
console.log('extended',global['nodeRocks-1.0']);

Added method to remove deep properties

const deleteOptions = {
        global: true,
        process: true,
        envName: 'nodeRocks-1.0',
        key: 'credentials'
};
const deleted = goenv.deleteProps(deleteOptions);

OPTIONS FOR deleteProps METHOD - example:

  • global: true,
  • process: true,
  • envName: 'nodeRocks-1.0',
  • key: 'credentials'

Added method to write an env file

let optionsWriteFile ={
        filename: 'myEnvFile',
        path: __dirname,
        envName: 'nodeRocks-1.0',
        global:true
};

goenv.writeEnvFile(optionsWriteFile, (err,done)=> 
{
        if(err)
        {
                console.log(err);
        };
        console.log(done);
});

OPTIONS FOR writeEnvFile METHOD - example:

  • filename: 'myEnvFile',
  • path: 'path/to/save/the/envFile'
  • envName: 'nodeRocks-1.0',
  • global:true
  • process: false
1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago