mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #4153 from node-red/remove-empty-global-config
Avoid creating empty global-config node if not needed
This commit is contained in:
commit
42166f5fc4
@ -50,7 +50,11 @@ RED.envVar = (function() {
|
|||||||
var new_env = [];
|
var new_env = [];
|
||||||
var items = list.editableList('items');
|
var items = list.editableList('items');
|
||||||
var credentials = gconf ? gconf.credentials : null;
|
var credentials = gconf ? gconf.credentials : null;
|
||||||
|
if (!gconf && list.editableList('length') === 0) {
|
||||||
|
// No existing global-config node and nothing in the list,
|
||||||
|
// so no need to do anything more
|
||||||
|
return
|
||||||
|
}
|
||||||
if (!credentials) {
|
if (!credentials) {
|
||||||
credentials = {
|
credentials = {
|
||||||
_ : {},
|
_ : {},
|
||||||
@ -78,6 +82,12 @@ RED.envVar = (function() {
|
|||||||
if (gconf === null) {
|
if (gconf === null) {
|
||||||
gconf = getGlobalConf(true);
|
gconf = getGlobalConf(true);
|
||||||
}
|
}
|
||||||
|
if (!gconf.credentials) {
|
||||||
|
gconf.credentials = {
|
||||||
|
_ : {},
|
||||||
|
map: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
if ((JSON.stringify(new_env) !== JSON.stringify(gconf.env)) ||
|
if ((JSON.stringify(new_env) !== JSON.stringify(gconf.env)) ||
|
||||||
(JSON.stringify(credentials) !== JSON.stringify(gconf.credentials))) {
|
(JSON.stringify(credentials) !== JSON.stringify(gconf.credentials))) {
|
||||||
gconf.env = new_env;
|
gconf.env = new_env;
|
||||||
|
Loading…
Reference in New Issue
Block a user