mirror of
https://github.com/jwinterm/node-tip-bot.git
synced 2026-10-17 05:41:42 +02:00
added work in progress webadmin
This commit is contained in:
+18
-1
@@ -2,13 +2,23 @@ var irc = require('irc')
|
||||
, winston = require('winston')
|
||||
, fs = require('fs')
|
||||
, yaml = require('js-yaml')
|
||||
, coin = require('node-dogecoin');
|
||||
, coin = require('node-dogecoin')
|
||||
, webadmin = require('../lib/webadmin/app');
|
||||
|
||||
// check if the config file exists
|
||||
if(!fs.existsSync('./config/config.yml')) {
|
||||
winston.error('Configuration file doesn\'t exist! Please read the README.md file first.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// handle sigint
|
||||
process.on('exit', function() {
|
||||
winston.info('Exiting...');
|
||||
if(client != null) {
|
||||
client.disconnect('My master ordered me to leave.');
|
||||
}
|
||||
});
|
||||
|
||||
// load settings
|
||||
var settings = yaml.load(fs.readFileSync('./config/config.yml', 'utf-8'));
|
||||
|
||||
@@ -43,6 +53,13 @@ coin.getBalance(function(err, balance) {
|
||||
winston.info('Connected to JSON RPC API. Current total balance is %d' + settings.coin.short_name, balance);
|
||||
})
|
||||
|
||||
// run webadmin
|
||||
if(settings.webadmin.enabled)
|
||||
{
|
||||
winston.info('Running webadmin on port %d', settings.webadmin.port);
|
||||
webadmin.app(settings.webadmin.port, coin, settings.webadmin, winston);
|
||||
}
|
||||
|
||||
// connect to the server
|
||||
winston.info('Connecting to the server...');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user