From be67f04afa008f44a644a0e5e266be054fe897f1 Mon Sep 17 00:00:00 2001 From: tigerbot Date: Wed, 24 May 2017 11:42:17 -0600 Subject: [PATCH] added the mDNS options to the example config --- bin/goldilocks.js | 8 +++++--- goldilocks.example.yml | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/goldilocks.js b/bin/goldilocks.js index 205074c..e853336 100755 --- a/bin/goldilocks.js +++ b/bin/goldilocks.js @@ -73,9 +73,11 @@ function readConfigAndRun(args) { if (!config.dns) { config.dns = { modules: { name: 'proxy', port: 3053 } }; } - if (!config.mdns) { - config.mdns = { port: 5353, broadcast: '224.0.0.251', ttl: 300 }; - } + // Use Object.assign to add any properties needed but not defined in the mdns config. + // It will first copy the defaults into an empty object, then copy any real config over that. + var mdnsDefaults = { port: 5353, broadcast: '224.0.0.251', ttl: 300 }; + config.mdns = Object.assign({}, mdnsDefaults, config.mdns || {}); + if (!config.tcp) { config.tcp = {}; } diff --git a/goldilocks.example.yml b/goldilocks.example.yml index 54e128b..7836148 100644 --- a/goldilocks.example.yml +++ b/goldilocks.example.yml @@ -52,3 +52,9 @@ http: domains: - '*.localhost.daplie.me' root: '/srv/www/:hostname' + +mdns: + disabled: false + port: 5353 + broadcast: '224.0.0.251' + ttl: 300