Skip to content

Commit

Permalink
Merge pull request nightscout#7647 from k2s/fix-empty-import-config
Browse files Browse the repository at this point in the history
Fix empty import config
  • Loading branch information
bewest authored Nov 1, 2022
2 parents 09c9f81 + ed7fdf7 commit 2c6ba28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/server/bootevent.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function boot (env, language) {

//////////////////////////////////////////////////
// Check Node version.
// Latest Node LTS releases are recommended and supported.
// Latest Node LTS releases are recommended and supported.
// Current Node releases MAY work, but are not recommended. Will be tested in CI
// Older Node versions or Node versions with known security issues will not work.
///////////////////////////////////////////////////
Expand All @@ -35,7 +35,7 @@ function boot (env, language) {
var nodeVersion = process.version;

const isLTS = process.release.lts ? true : false;

if (isLTS && (semver.satisfies(nodeVersion, '^16.0.0') || semver.satisfies(nodeVersion, '^14.0.0'))) {
//Latest Node 14 LTS and Node 16 LTS are recommended and supported.
//Require at least Node 14 without known security issues
Expand Down Expand Up @@ -72,11 +72,15 @@ function boot (env, language) {
var configURL = env.IMPORT_CONFIG || null;
var url = require('url');
var href = null;
try {
href = url.parse(configURL).href;
} catch (e) {
console.error('Parsing config URL from IMPORT_CONFIG failed');

if (configURL) {
try {
href = url.parse(configURL).href;
} catch (e) {
console.error('Parsing config URL from IMPORT_CONFIG failed');
}
}

if(configURL && href) {
var request = require('request');
console.log('Getting settings from', href);
Expand Down Expand Up @@ -267,7 +271,7 @@ function boot (env, language) {
function setupListeners (ctx, next) {

console.log('Executing setupListeners');

if (hasBootErrors(ctx)) {
return next();
}
Expand Down
4 changes: 4 additions & 0 deletions webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ module.exports = {
rules
},
resolve: {
fallback: {
'process/browser': require.resolve('process/browser'),
events: require.resolve('events/')
},
alias: {
stream: 'stream-browserify',
crypto: 'crypto-browserify',
Expand Down

0 comments on commit 2c6ba28

Please sign in to comment.