Skip to content

Commit

Permalink
Add dotenv support
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansl committed Nov 7, 2019
1 parent 8d00f6c commit 17b7225
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Image Shrinker-linux-x64/
/dist/
/assets/css/imageshrinker.css.map
/assets/css/spectre.css.map
/.env
18 changes: 15 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { app, BrowserWindow, ipcMain, dialog, TouchBar } = require(
'electron');
const dotenv = require('dotenv').config();
const nativeImage = require('electron').nativeImage;
const { autoUpdater } = require('electron-updater');
const log = require('electron-log');
Expand All @@ -14,6 +15,19 @@ const makeDir = require('make-dir');
const { TouchBarButton } = TouchBar;
const gifsicle = require('gifsicle');

global.debug = {
devTools: 0
};

/**
* Support for .env
*/
if(!dotenv.error){
global.debug = {
devTools: process.env.ELECTRON_DEBUG
};
}

/**
* Start logging in os log
*/
Expand All @@ -27,9 +41,7 @@ log.info('App starting...');
*/
let svg = new svgo();
let mainWindow;
global.debug = {
devTools: 0
};


/**
* Create the browser window
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@
"author": "Stefan Schulz-Lauterbach",
"license": "CC0-1.0",
"devDependencies": {
"dotenv": "^8.2.0",
"electron": "^6.0.12",
"electron-builder": "^21.2.0",
"electron-builder": "^22.1.0",
"electron-installer-dmg": "^3.0.0",
"fs-extra": "^8.1.0"
},
"dependencies": {
"electron-log": "^3.0.8",
"electron-settings": "^3.2.0",
"electron-updater": "^4.1.2",
"electron-updater": "^4.2.0",
"gifsicle": "^4.0.1",
"make-dir": "^3.0.0",
"mozjpeg": "^6.0.1",
Expand Down

0 comments on commit 17b7225

Please sign in to comment.