]>
git.r.bdr.sh - rbdr/tomato-sauce/blob - bin/tomato_sauce.js
5a416d5fd8a1f209312c9a055d01cfe8c5ad4f94
5 /* eslint no-console: 0 */
7 const Path
= require('path');
8 const Getenv
= require('getenv');
10 const TomatoSauce
= require('..');
11 const Util
= require('../lib/util');
14 port: Getenv
.int('TOMATO_SAUCE_PORT', 9999),
15 frequency: Getenv
.int('TOMATO_SAUCE_FREQUENCY', 333),
16 modulation: Getenv
.int('TOMATO_SAUCE_MODULATION_SPEED', 5)
19 const screenPath
= Getenv('TOMATO_SAUCE_SCREEN_PATH', Path
.join(__dirname
, '../lib/screens'));
20 const rendererPath
= Getenv('TOMATO_SAUCE_RENDERER_PATH', Path
.join(__dirname
, '../lib/renderers'));
22 Util
.loadFiles(screenPath
).then(function (screens
) {
23 config
.screens
= screens
;
24 return Util
.loadFiles(rendererPath
);
25 }).then(function (renderers
) {
26 config
.renderers
= renderers
;
28 let tomatoSauce
= new TomatoSauce(config
);
30 tomatoSauce
.on('listening', function (event
) {
31 const address
= event
.data
.server
.address();
32 console
.log(`Tomato Sauce listening on: ${address.address}:${address.port}`);
35 tomatoSauce
.on('error', function (error
) {
36 console
.error(error
.stack
|| error
.message
|| error
);