Enable ATOM_UPDATE_URL_PREFIX env var to override update server URL

This commit is contained in:
David Wilson
2018-09-25 14:28:02 -07:00
parent 3e9759ca58
commit 12b02448d8
2 changed files with 5 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ const CONFIG = require('../config')
module.exports = (packagedAppPath) => {
const archSuffix = process.arch === 'ia32' ? '' : '-' + process.arch
const updateUrlPrefix = process.env.ATOM_UPDATE_URL_PREFIX || 'https://atom.io'
const options = {
appDirectory: packagedAppPath,
authors: 'GitHub Inc.',
@@ -17,7 +18,7 @@ module.exports = (packagedAppPath) => {
outputDirectory: CONFIG.buildOutputPath,
noMsi: true,
noDelta: CONFIG.channel === 'nightly', // Delta packages are broken for nightly versions past nightly9 due to Squirrel/NuGet limitations
remoteReleases: `https://atom.io/api/updates${archSuffix}?version=${CONFIG.computedAppVersion}`,
remoteReleases: `${updateUrlPrefix}/api/updates${archSuffix}?version=${CONFIG.computedAppVersion}`,
setupExe: `AtomSetup${process.arch === 'x64' ? '-x64' : ''}.exe`,
setupIcon: path.join(CONFIG.repositoryRootPath, 'resources', 'app-icons', CONFIG.channel, 'atom.ico')
}

View File

@@ -22,15 +22,16 @@ class AutoUpdateManager extends EventEmitter {
this.config = config
this.state = IdleState
this.iconPath = path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
this.updateUrlPrefix = process.env.ATOM_UPDATE_URL_PREFIX || 'https://atom.io'
}
initialize () {
if (process.platform === 'win32') {
const archSuffix = process.arch === 'ia32' ? '' : `-${process.arch}`
this.feedUrl = `https://atom.io/api/updates${archSuffix}?version=${this.version}`
this.feedUrl = `${this.updateUrlPrefix}/api/updates${archSuffix}?version=${this.version}`
autoUpdater = require('./auto-updater-win32')
} else {
this.feedUrl = `https://atom.io/api/updates?version=${this.version}`;
this.feedUrl = `${this.updateUrlPrefix}/api/updates?version=${this.version}`;
({autoUpdater} = require('electron'))
}