X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/a41763dd463339765081c1f968a7b93b8ccf572f..3ec8e14833b55d6bff4cf5702f90e1bb9a1b1e40:/bin/tomato_sauce.js?ds=inline diff --git a/bin/tomato_sauce.js b/bin/tomato_sauce.js index 5a416d5..524c361 100755 --- a/bin/tomato_sauce.js +++ b/bin/tomato_sauce.js @@ -11,31 +11,38 @@ const TomatoSauce = require('..'); const Util = require('../lib/util'); const config = { - port: Getenv.int('TOMATO_SAUCE_PORT', 9999), - frequency: Getenv.int('TOMATO_SAUCE_FREQUENCY', 333), - modulation: Getenv.int('TOMATO_SAUCE_MODULATION_SPEED', 5) + port: Getenv.int('TOMATO_SAUCE_PORT', 7777), + frequency: Getenv.int('TOMATO_SAUCE_FREQUENCY', 333), + modulation: Getenv.int('TOMATO_SAUCE_MODULATION_SPEED', 5) }; const screenPath = Getenv('TOMATO_SAUCE_SCREEN_PATH', Path.join(__dirname, '../lib/screens')); const rendererPath = Getenv('TOMATO_SAUCE_RENDERER_PATH', Path.join(__dirname, '../lib/renderers')); -Util.loadFiles(screenPath).then(function (screens) { - config.screens = screens; - return Util.loadFiles(rendererPath); -}).then(function (renderers) { - config.renderers = renderers; -}).then(function () { - let tomatoSauce = new TomatoSauce(config); - - tomatoSauce.on('listening', function (event) { - const address = event.data.server.address(); - console.log(`Tomato Sauce listening on: ${address.address}:${address.port}`); - }); - - tomatoSauce.on('error', function (error) { - console.error(error.stack || error.message || error); - process.exit(1); - }); - - tomatoSauce.run(); -}); +Util.loadFiles(screenPath).then((screens) => { + + config.screens = screens; + return Util.loadFiles(rendererPath); +}) + .then((renderers) => { + + config.renderers = renderers; + }) + .then(() => { + + const tomatoSauce = new TomatoSauce(config); + + tomatoSauce.on('listening', (event) => { + + const address = event.data.server.address(); + console.log(`Tomato Sauce listening on: ${address.address}:${address.port}`); + }); + + tomatoSauce.on('error', (error) => { + + console.error(error.stack || error.message || error); + process.exit(1); + }); + + tomatoSauce.run(); + });