Cloud Pipeline WebDav Client configuration - app initialization fixed
@@ -5,16 +5,6 @@ const readWebdavConfiguration = require('./read-webdav-configuration');
// You should remove "browser": ... config from package.json of axios module MANUALLY!
require('axios').defaults.adapter = require('axios/lib/adapters/http');
-readWebdavConfiguration()
- .then((webdavClientConfig) => {
- global.webdavClient = {
- config: webdavClientConfig,
- };
- if (webdavClientConfig.ignoreCertificateErrors) {
- console.log('"ignore-certificate-errors": true');
- app.commandLine.appendSwitch('ignore-certificate-errors');
- }
-
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
app.quit();
@@ -43,8 +33,18 @@ readWebdavConfiguration()
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
+ readWebdavConfiguration()
+ .then((webdavClientConfig) => {
+ global.webdavClient = {
+ config: webdavClientConfig,
+ };
+ if (webdavClientConfig.ignoreCertificateErrors) {
+ console.log('"ignore-certificate-errors": true');
+ app.commandLine.appendSwitch('ignore-certificate-errors');
+ }
createWindow();
});
+});
// Quit when all windows are closed.
app.on('window-all-closed', () => {
@@ -59,7 +59,16 @@ readWebdavConfiguration()
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
- createWindow();
+ readWebdavConfiguration()
+ .then((webdavClientConfig) => {
+ global.webdavClient = {
+ config: webdavClientConfig,
+ };
+ if (webdavClientConfig.ignoreCertificateErrors) {
+ console.log('"ignore-certificate-errors": true');
+ app.commandLine.appendSwitch('ignore-certificate-errors');
}
+ createWindow();
});
+ }
});
