config: fixes.
This commit is contained in:
parent
73c54cf5ed
commit
ab58f2481c
@ -76,7 +76,7 @@ config.parse = function parse(options) {
|
|||||||
if (!data.knownPeers)
|
if (!data.knownPeers)
|
||||||
data.knownPeers = config.parseKnown(prefix + '/known-peers');
|
data.knownPeers = config.parseKnown(prefix + '/known-peers');
|
||||||
|
|
||||||
if (!text.authPeers)
|
if (!data.authPeers)
|
||||||
data.authPeers = config.parseAuth(prefix + '/authorized-peers');
|
data.authPeers = config.parseAuth(prefix + '/authorized-peers');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,8 +249,8 @@ config.parseText = function parseText(text) {
|
|||||||
key = line.trim();
|
key = line.trim();
|
||||||
value = null;
|
value = null;
|
||||||
} else {
|
} else {
|
||||||
key = line.slice(0, eq).trim();
|
key = line.substring(0, eq).trim();
|
||||||
value = line.slice(eq + 1).trim();
|
value = line.substring(eq + 1).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
key = key.replace(/\-/g, '').toLowerCase();
|
key = key.replace(/\-/g, '').toLowerCase();
|
||||||
@ -259,6 +259,9 @@ config.parseText = function parseText(text) {
|
|||||||
if (alias)
|
if (alias)
|
||||||
key = alias;
|
key = alias;
|
||||||
|
|
||||||
|
if (key.length === 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (value.length === 0)
|
if (value.length === 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -309,6 +312,9 @@ config.parseArg = function parseArg(argv) {
|
|||||||
if (value.length === 0)
|
if (value.length === 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (key.length === 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
data[key] = value;
|
data[key] = value;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -377,6 +383,9 @@ config.parseEnv = function parseEnv(env) {
|
|||||||
if (alias)
|
if (alias)
|
||||||
key = alias;
|
key = alias;
|
||||||
|
|
||||||
|
if (key.length === 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (value.length === 0)
|
if (value.length === 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -417,6 +426,7 @@ config.parseKnownText = function parseKnownText(text) {
|
|||||||
host = hostname[0];
|
host = hostname[0];
|
||||||
ip = hostname[1];
|
ip = hostname[1];
|
||||||
} else {
|
} else {
|
||||||
|
host = null;
|
||||||
ip = hostname[0];
|
ip = hostname[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,9 +436,12 @@ config.parseKnownText = function parseKnownText(text) {
|
|||||||
if (key.length !== 33)
|
if (key.length !== 33)
|
||||||
throw new Error('Invalid key: ' + parts[1]);
|
throw new Error('Invalid key: ' + parts[1]);
|
||||||
|
|
||||||
if (host)
|
if (host && host.length > 0)
|
||||||
map[host] = key;
|
map[host] = key;
|
||||||
|
|
||||||
|
if (ip.length === 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
map[ip] = key;
|
map[ip] = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user