fixed bug when tunnel tokens not defined in config

This commit is contained in:
tigerbot 2017-07-31 18:35:49 -06:00
parent 363620d7fb
commit 3bd9bac390
1 changed files with 14 additions and 11 deletions

View File

@ -173,18 +173,21 @@ module.exports.create = function (deps, config) {
return activeTunnels[data.tunnelUrl].clear(data.jwt);
}
var confTokens = config.tunnel;
if (typeof confTokens === 'string') {
confTokens = confTokens.split(',');
}
confTokens.forEach(function (jwt) {
if (typeof jwt === 'object') {
jwt.owner = 'config';
addToken(jwt);
} else {
addToken({ jwt: jwt, owner: 'config' });
if (config.tunnel) {
var confTokens = config.tunnel;
if (typeof confTokens === 'string') {
confTokens = confTokens.split(',');
}
});
confTokens.forEach(function (jwt) {
if (typeof jwt === 'object') {
jwt.owner = 'config';
addToken(jwt);
} else {
addToken({ jwt: jwt, owner: 'config' });
}
});
}
storage.all().then(function (stored) {
stored.forEach(function (result) {