Skip to content
Permalink
Browse files

feat(config): read autoupdate settings from global config

  • Loading branch information...
mrfelton committed Apr 22, 2019
1 parent c92c81a commit 38ffa9ed8ba4a069686e298950612f8e532b54d8
Showing with 19 additions and 14 deletions.
  1. +9 −0 config/custom-environment-variables.json
  2. +5 −0 config/default.js
  3. +5 −14 electron/updater.js
@@ -7,10 +7,19 @@
"domain": "DB_DOMAIN"
},

"autoupdate": {
"active": {
"__name": "AUTOUPDATE_ACTIVE",
"__format": "json"
},
"channel": "AUTOUPDATE_CHANNEL"
},

"chains": {
"__name": "CHAINS",
"__format": "json"
},

"networks": {
"__name": "NETWORKS",
"__format": "json"
@@ -16,6 +16,11 @@ module.exports = {
domain: isStableVersion(getPackageDetails().version, STABLE_VERSION) ? null : 'next',
},

autoupdate: {
active: true,
channel: 'beta',
},

// Supported chains.
chains: ['bitcoin', 'litecoin'],

@@ -1,36 +1,27 @@
import { dialog } from 'electron'
import { autoUpdater } from 'electron-updater'
import isDev from 'electron-is-dev'
import config from 'config'
import { updaterLog } from '@zap/utils/log'
import delay from '@zap/utils/delay'

autoUpdater.logger = updaterLog

/**
* Update Channel
* supported channels are 'alpha', 'beta' and 'latest'
* Refer electron-builder docs
*/
autoUpdater.channel = process.env.AUTOUPDATE_CHANNEL || 'beta'
autoUpdater.channel = config.autoupdate.channel
autoUpdater.allowDowngrade = false

/**
* @class ZapController
* @class ZapUpdater
*
* The ZapUpdater class manages the electron auto update process.
*/
class ZapUpdater {
/**
* Create a new ZapUpdater instance.
* @param {BrowserWindow} mainWindow BrowserWindow instance to interact with
*/
constructor(mainWindow) {
this.mainWindow = mainWindow
}

init() {
// Do not run the updater if we are running in dev mode.
if (isDev) {
// Do not run the updater if we are running in dev mode or if autoupdates are disabled.
if (isDev || !config.autoupdate.active) {
return
}

0 comments on commit 38ffa9e

Please sign in to comment.
You can’t perform that action at this time.