From 8f4a733391e5323dc6b718fb047b75f17d6dad9e Mon Sep 17 00:00:00 2001 From: tigerbot Date: Thu, 5 Oct 2017 18:11:58 -0600 Subject: [PATCH] changed module config property name --- bin/goldilocks.js | 5 +++++ lib/goldilocks.js | 4 ++-- lib/modules/http.js | 8 ++++---- lib/modules/tls.js | 8 ++++---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bin/goldilocks.js b/bin/goldilocks.js index ea936b6..f7b59c3 100755 --- a/bin/goldilocks.js +++ b/bin/goldilocks.js @@ -39,6 +39,11 @@ function fixRawConfig(config) { mod.id = crypto.randomBytes(4).toString('hex'); updated = true; } + if (mod.name) { + mod.type = mod.type || mod.name; + delete mod.name; + updated = true; + } }); } function updateDomains(list) { diff --git a/lib/goldilocks.js b/lib/goldilocks.js index a0b3fcc..3e3ee28 100644 --- a/lib/goldilocks.js +++ b/lib/goldilocks.js @@ -101,7 +101,7 @@ module.exports.create = function (deps, config) { } var socket = require('dgram').createSocket('udp4'); config.dns.modules.forEach(function (mod) { - if (mod.name !== 'proxy') { + if (mod.type !== 'proxy') { console.warn('found bad DNS module', mod); return; } @@ -213,7 +213,7 @@ module.exports.create = function (deps, config) { addPorts(config.tcp.bind); (config.tcp.modules || []).forEach(function (mod) { - if (mod.name === 'forward') { + if (mod.type === 'forward') { var forwarder = createTcpForwarder(mod); mod.ports.forEach(function (port) { if (!tcpPortMap[port]) { diff --git a/lib/modules/http.js b/lib/modules/http.js index 365b09a..ed3c571 100644 --- a/lib/modules/http.js +++ b/lib/modules/http.js @@ -426,10 +426,10 @@ module.exports.create = function (deps, conf, greenlockMiddleware) { var subProm = PromiseA.resolve(false); dom.modules.forEach(function (mod) { - if (moduleChecks[mod.name]) { + if (moduleChecks[mod.type]) { subProm = subProm.then(function (handled) { if (handled) { return handled; } - return moduleChecks[mod.name](mod, conn, opts, headers); + return moduleChecks[mod.type](mod, conn, opts, headers); }); } else { console.warn('unknown HTTP module under domains', dom.names.join(','), mod); @@ -447,8 +447,8 @@ module.exports.create = function (deps, conf, greenlockMiddleware) { return false; } - if (moduleChecks[mod.name]) { - return moduleChecks[mod.name](mod, conn, opts, headers); + if (moduleChecks[mod.type]) { + return moduleChecks[mod.type](mod, conn, opts, headers); } console.warn('unknown HTTP module found', mod); }); diff --git a/lib/modules/tls.js b/lib/modules/tls.js index 19bb2f1..c8191d2 100644 --- a/lib/modules/tls.js +++ b/lib/modules/tls.js @@ -142,7 +142,7 @@ module.exports.create = function (deps, config, netHandler) { } return dom.modules.some(function (mod) { - if (mod.name !== 'acme') { + if (mod.type !== 'acme') { return false; } complete(mod, dom.names); @@ -156,7 +156,7 @@ module.exports.create = function (deps, config, netHandler) { if (Array.isArray(config.tls.modules)) { handled = config.tls.modules.some(function (mod) { - if (mod.name !== 'acme') { + if (mod.type !== 'acme') { return false; } if (!nameMatchesDomains(opts.domain, mod.domains)) { @@ -322,10 +322,10 @@ module.exports.create = function (deps, config, netHandler) { } function checkModule(mod) { - if (mod.name === 'proxy') { + if (mod.type === 'proxy') { return proxy(socket, opts, mod); } - if (mod.name !== 'acme') { + if (mod.type !== 'acme') { console.error('saw unknown TLS module', mod); } }