From 1cf9d7bd57cc33f9c894cc232e84706865edba83 Mon Sep 17 00:00:00 2001 From: Marian Oancea Date: Thu, 5 Feb 2015 01:55:48 +0200 Subject: [PATCH] added default config file --- .node-xmlhttprequest-sync-99320 | 0 app.js | 11 ++++++++++- config/nodes.default.js | 16 ++++++++++++++++ config/nodes.js | 28 ---------------------------- 4 files changed, 26 insertions(+), 29 deletions(-) create mode 100644 .node-xmlhttprequest-sync-99320 create mode 100644 config/nodes.default.js delete mode 100644 config/nodes.js diff --git a/.node-xmlhttprequest-sync-99320 b/.node-xmlhttprequest-sync-99320 new file mode 100644 index 0000000..e69de29 diff --git a/app.js b/app.js index dd76910..5a72dca 100644 --- a/app.js +++ b/app.js @@ -3,8 +3,17 @@ var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var bodyParser = require('body-parser'); +var fs = require('fs'); -var config = require('./config/nodes'); +var config; + +if(fs.existsSync('./config/nodes.js')){ + config = require('./config/nodes'); +} else { + config = require('./config/nodes.default'); +} +console.log(config); +// var config = require('./config/nodes'); var Node = require('./models/node'); var app = express(); diff --git a/config/nodes.default.js b/config/nodes.default.js new file mode 100644 index 0000000..513dc86 --- /dev/null +++ b/config/nodes.default.js @@ -0,0 +1,16 @@ +var nodes = [ + // { + // name: 'Readable name of the node', + // type: 'C++/Go...', + // rpcHost: 'your node IP here', + // rpcPort: 'JSON-RPC port here' + // }, + { + name: 'local', + type: 'C++', + rpcHost: 'localhost', + rpcPort: '8080' + } +]; + +module.exports = nodes; diff --git a/config/nodes.js b/config/nodes.js deleted file mode 100644 index f99b4dc..0000000 --- a/config/nodes.js +++ /dev/null @@ -1,28 +0,0 @@ -var nodes = [ - { - name: 'instance 1', - type: 'C++', - rpcHost: '54.173.252.182', - rpcPort: '8080' - }, - { - name: 'instance 2', - type: 'C++', - rpcHost: '54.209.133.248', - rpcPort: '8080' - }, - { - name: 'instance 3', - type: 'C++', - rpcHost: '54.174.67.126', - rpcPort: '8080' - }, - { - name: 'local', - type: 'C++', - rpcHost: 'localhost', - rpcPort: '8080' - } -]; - -module.exports = nodes;