changed module config property name

This commit is contained in:
tigerbot 2017-10-05 18:11:58 -06:00
parent ded53cf45c
commit 8f4a733391
4 changed files with 15 additions and 10 deletions

View File

@ -39,6 +39,11 @@ function fixRawConfig(config) {
mod.id = crypto.randomBytes(4).toString('hex'); mod.id = crypto.randomBytes(4).toString('hex');
updated = true; updated = true;
} }
if (mod.name) {
mod.type = mod.type || mod.name;
delete mod.name;
updated = true;
}
}); });
} }
function updateDomains(list) { function updateDomains(list) {

View File

@ -101,7 +101,7 @@ module.exports.create = function (deps, config) {
} }
var socket = require('dgram').createSocket('udp4'); var socket = require('dgram').createSocket('udp4');
config.dns.modules.forEach(function (mod) { config.dns.modules.forEach(function (mod) {
if (mod.name !== 'proxy') { if (mod.type !== 'proxy') {
console.warn('found bad DNS module', mod); console.warn('found bad DNS module', mod);
return; return;
} }
@ -213,7 +213,7 @@ module.exports.create = function (deps, config) {
addPorts(config.tcp.bind); addPorts(config.tcp.bind);
(config.tcp.modules || []).forEach(function (mod) { (config.tcp.modules || []).forEach(function (mod) {
if (mod.name === 'forward') { if (mod.type === 'forward') {
var forwarder = createTcpForwarder(mod); var forwarder = createTcpForwarder(mod);
mod.ports.forEach(function (port) { mod.ports.forEach(function (port) {
if (!tcpPortMap[port]) { if (!tcpPortMap[port]) {

View File

@ -426,10 +426,10 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
var subProm = PromiseA.resolve(false); var subProm = PromiseA.resolve(false);
dom.modules.forEach(function (mod) { dom.modules.forEach(function (mod) {
if (moduleChecks[mod.name]) { if (moduleChecks[mod.type]) {
subProm = subProm.then(function (handled) { subProm = subProm.then(function (handled) {
if (handled) { return handled; } if (handled) { return handled; }
return moduleChecks[mod.name](mod, conn, opts, headers); return moduleChecks[mod.type](mod, conn, opts, headers);
}); });
} else { } else {
console.warn('unknown HTTP module under domains', dom.names.join(','), mod); console.warn('unknown HTTP module under domains', dom.names.join(','), mod);
@ -447,8 +447,8 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
return false; return false;
} }
if (moduleChecks[mod.name]) { if (moduleChecks[mod.type]) {
return moduleChecks[mod.name](mod, conn, opts, headers); return moduleChecks[mod.type](mod, conn, opts, headers);
} }
console.warn('unknown HTTP module found', mod); console.warn('unknown HTTP module found', mod);
}); });

View File

@ -142,7 +142,7 @@ module.exports.create = function (deps, config, netHandler) {
} }
return dom.modules.some(function (mod) { return dom.modules.some(function (mod) {
if (mod.name !== 'acme') { if (mod.type !== 'acme') {
return false; return false;
} }
complete(mod, dom.names); complete(mod, dom.names);
@ -156,7 +156,7 @@ module.exports.create = function (deps, config, netHandler) {
if (Array.isArray(config.tls.modules)) { if (Array.isArray(config.tls.modules)) {
handled = config.tls.modules.some(function (mod) { handled = config.tls.modules.some(function (mod) {
if (mod.name !== 'acme') { if (mod.type !== 'acme') {
return false; return false;
} }
if (!nameMatchesDomains(opts.domain, mod.domains)) { if (!nameMatchesDomains(opts.domain, mod.domains)) {
@ -322,10 +322,10 @@ module.exports.create = function (deps, config, netHandler) {
} }
function checkModule(mod) { function checkModule(mod) {
if (mod.name === 'proxy') { if (mod.type === 'proxy') {
return proxy(socket, opts, mod); return proxy(socket, opts, mod);
} }
if (mod.name !== 'acme') { if (mod.type !== 'acme') {
console.error('saw unknown TLS module', mod); console.error('saw unknown TLS module', mod);
} }
} }