mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Improve processing when default is an alias
and fix test cases
This commit is contained in:
committed by
HirokiUchikawa
parent
e046fc1ac5
commit
0be9c88106
@@ -37,7 +37,7 @@ function init(_settings) {
|
||||
function load() {
|
||||
// load & init plugins in settings.contextStorage
|
||||
var plugins = settings.contextStorage;
|
||||
var alias = null;
|
||||
var isAlias = false;
|
||||
if (plugins) {
|
||||
noContextStorage = false;
|
||||
for(var pluginName in plugins){
|
||||
@@ -45,7 +45,7 @@ function load() {
|
||||
continue;
|
||||
}
|
||||
if(pluginName === "default" && typeof plugins[pluginName] === "string"){
|
||||
alias = plugins[pluginName];
|
||||
isAlias = true;
|
||||
continue;
|
||||
}
|
||||
var plugin;
|
||||
@@ -67,9 +67,9 @@ function load() {
|
||||
throw new Error(log._("context.error-module-not-defined", {storage:pluginName}));
|
||||
}
|
||||
}
|
||||
if(alias){
|
||||
if(externalContexts.hasOwnProperty(alias)){
|
||||
externalContexts["default"] = externalContexts[alias];
|
||||
if(isAlias){
|
||||
if(externalContexts.hasOwnProperty(plugins["default"])){
|
||||
externalContexts["default"] = externalContexts[plugins["default"]];
|
||||
}else{
|
||||
throw new Error(log._("context.error-invalid-default-module", {storage:plugins["default"]}));
|
||||
}
|
||||
|
Reference in New Issue
Block a user