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