1.5.0 • Published 6 years ago

electron-config-env v1.5.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Build Status Coverage Status

Electron Config Env

Can be used inside an Electron app to have seperate stage environment configurations. One for development and one for packaged apps in production use.

The configuration values are simple key/value pairs within .env files you specify inside your project root folder.

Installation

npm install @1amgr00t/electron-config-env

Usage

There needs to be two .env files in your project root folder:

  • dev.env - development stage
  • prod.env - production stage

These two files should hold key/value pairs of stage specific configuration values you need. In fact, dev.env is optional, because the module will look for a prod.env file if the first is absent.

Example:

dev.env:

myVar1='a dev stage var'
myVar2='another dev stage var'

prod.env:

myVar1='a dev prod var'
myVar2='another dev prod var'

Access your config values from anywhere, the module will deliver a single instance throughout the app:

require('@1amgr00t/electron-config-env');
let myVar1 = config.myVar1; 
let myVar2 = config.myVar2;

Important: Your need to ship your app with only the prod.env, otherwise dev.env will be used in your packaged app. You can do this by either simple delete dev.env or even better by ignore this file within your packager config or build script. Electron Packager for example has an '--ignore' option.

Tests

npm test
1.5.0

6 years ago

1.4.1

6 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.6

7 years ago

0.3.5

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.1.0

7 years ago