From bae4c464e5324182acafef152eefe1cac63144c9 Mon Sep 17 00:00:00 2001 From: unek Date: Sat, 22 Feb 2014 13:03:58 +0100 Subject: [PATCH] moved the config file --- app.js | 9 ++++----- config.yml | 34 ++++++++++++++++++++++++++++++++++ config/irc.yml | 35 ----------------------------------- package.json | 2 +- 4 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 config.yml delete mode 100644 config/irc.yml diff --git a/app.js b/app.js index 77427b5..74e306a 100644 --- a/app.js +++ b/app.js @@ -1,13 +1,14 @@ var irc = require('irc') , winston = require('winston') -, config = require('yaml-config') +, fs = require('fs') +, yaml = require('js-yaml') , coin = require('node-dogecoin'); // load winston's cli defaults winston.cli(); // load settings -var settings = config.readConfig('./config/irc.yml'); +var settings = yaml.load(fs.readFileSync("./config.yml", "utf-8")); // connect to coin json-rpc winston.info('Connecting to coind...'); @@ -40,8 +41,6 @@ var client = new irc.Client(settings.connection.host, settings.login.nickname, { , channels: settings.channels , userName: settings.login.username , realName: settings.login.realname - -, debug: true }); // gets user's login status @@ -246,7 +245,7 @@ client.addListener('message', function(from, channel, message) { return; } }); - } + }); }); }); } else { diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..0d89f37 --- /dev/null +++ b/config.yml @@ -0,0 +1,34 @@ +connection: + host: irc.freenode.net + port: 6667 + secure: false +login: + nickname: 'nodetip' + username: 'nodetip' + realname: node.js dogecoin tipping bot +channels: + - '##tipbots' +rpc: + host: localhost + port: 22555 + user: dogecoinrpc + pass: pass + master_account: unek +coin: + withdrawal_fee: 2 + min_withdraw: 5 + min_confirmations: 3 + short_name: ' DOGE' + full_name: dogecoin +messages: + error: 'Sorry %name%, something went wrong.' + no_funds: "Sorry %name%, you don't have enough funds (you're %short% %short_name% short)" + not_identified: '%name%: You need to be identified with NickServ to tip.' + tipped: 'Wow! %from% tipped %to% %amount%%short_name%! "/msg %nick% help" to claim.' + balance: '%name% has %balance%%short_name%.' + balance_unconfirmed: '%name% has %balance%%short_name% (unconfirmed: %unconfirmed%%short_name%)' + deposit_address: "%name%'s deposit address is %address%" + withdraw_too_small: 'Sorry %name%, you need to withdraw at least %min_withdraw%%short_name% (you have %balance%%short_name%)' + invalid_address: 'Sorry %name%, the address you specified is invalid (%address%).' + withdraw_success: '%name%: %amount%%short_name% has been withdrawn from your account to %address%' + withdraw_success2: 'You have been charged %withdrawal_fee%%short_name% withdrawal fee. Transaction id: %transaction%.' \ No newline at end of file diff --git a/config/irc.yml b/config/irc.yml deleted file mode 100644 index a0c88a3..0000000 --- a/config/irc.yml +++ /dev/null @@ -1,35 +0,0 @@ -development: - connection: - host: irc.freenode.net - port: 6667 - secure: false - login: - nickname: 'nodetip' - username: 'nodetip' - realname: node.js dogecoin tipping bot - channels: - - '##tipbots' - rpc: - host: localhost - port: 22555 - user: 'dogecoinrpc' - pass: 'pass' - master_account: unek - coin: - withdrawal_fee: 2 - min_withdraw: 5 - min_confirmations: 3 - short_name: ' DOGE' - full_name: dogecoin - messages: - error: 'Sorry %name%, something went wrong.' - no_funds: "Sorry %name%, you don't have enough funds (you're %short% %short_name% short)" - not_identified: '%name%: You need to be identified with NickServ to tip.' - tipped: 'Wow! %from% tipped %to% %amount%%short_name%! "/msg %nick% help" to claim.' - balance: '%name% has %balance%%short_name%.' - balance_unconfirmed: '%name% has %balance%%short_name% (unconfirmed: %unconfirmed%%short_name%)' - deposit_address: "%name%'s deposit address is %address%" - withdraw_too_small: 'Sorry %name%, you need to withdraw at least %min_withdraw%%short_name% (you have %balance%%short_name%)' - invalid_address: 'Sorry %name%, the address you specified is invalid (%address%).' - withdraw_success: '%name%: %amount%%short_name% has been withdrawn from your account to %address%' - withdraw_success2: 'You have been charged %withdrawal_fee%%short_name% withdrawal fee. Transaction id: %transaction%.' \ No newline at end of file diff --git a/package.json b/package.json index 7910583..5477e14 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "app.js", "dependencies": { "irc": "~0.3.6", - "yaml-config": "~0.3.0", + "js-yaml": "~3.0.1", "winston": "~0.7.2", "node-dogecoin": "~0.3.5" },