netplaySniff – Diff between revs 6 and 7

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 6 Rev 7
Line 56... Line 56...
56 .command('run') 56 .command('run')
57 .option('-c, --config <path>', 'path to the configuration file', 'config.yml') 57 .option('-c, --config <path>', 'path to the configuration file', 'config.yml')
58 .option('-d, --database <path>', 'the path where to store a database', 'db/players.db') 58 .option('-d, --database <path>', 'the path where to store a database', 'db/players.db')
59 .description('run the program as a daemon') 59 .description('run the program as a daemon')
60 .action((options) => { 60 .action((options) => {
61 logger.info(`running as a daemon: ${options.database}`) 61 logger.info(`running as a daemon with configuraton options from ${options.config} and database at ${options.database}`)
62 logger.info(`running as a daemon: ${options.config}`) -  
Line 63... Line -...
63   -  
64 // load configuration file. -  
Line 65... Line 62...
65 var config = YAML.load(options.config) 62  
66   63  
67 // Watch the configuration file for changes. 64 // Watch the configuration file for changes.
68 const configWatch = inotify.addWatch({ 65 const configWatch = inotify.addWatch({
69 path: options.config, 66 path: options.config,
70 watch_for: Inotify.IN_MODIFY, 67 watch_for: Inotify.IN_MODIFY,
71 callback: function (event) { 68 callback: function (event) {
-   69 logger.info(`Reloading configuration file config.yml`)
72 logger.info(`Reloading configuration file config.yml`) 70 config = YAML.load(options.config)
73 config = YAML.load(options.config) 71 config.db.file = options.database
Line -... Line 72...
-   72 }
-   73 })
-   74  
-   75 // load configuration file.
-   76 var config = YAML.load(options.config)
74 } 77 // override configuration options with command-line options
Line 75... Line 78...
75 }) 78 config.db.file = options.database
76   79  
77 const mqttClient = mqtt.connect(config.mqtt.connect) 80 const mqttClient = mqtt.connect(config.mqtt.connect)
Line 149... Line 152...
149   152  
Line 150... Line 153...
150 logger.info(`Player ${netplay.nick} joined via IP ${netplay.ip}`); 153 logger.info(`Player ${netplay.nick} joined via IP ${netplay.ip}`);
151   154  
152 const db = new sqlite.Database(config.db.file, sqlite.OPEN_CREATE | sqlite.OPEN_READWRITE | sqlite.OPEN_FULLMUTEX, (error) => { 155 const db = new sqlite.Database(config.db.file, sqlite.OPEN_CREATE | sqlite.OPEN_READWRITE | sqlite.OPEN_FULLMUTEX, (error) => {
153 if (error) { 156 if (error) {
154 logger.error(`failed to open database: ${config.db.file}`) 157 logger.error(`failed to open database: ${error}`)
Line 155... Line 158...
155 return 158 return
156 } 159 }