From 4d111a9853d783b1412b227e2fe7af8f2f05ff04 Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Wed, 26 Feb 2014 16:27:22 -0300 Subject: [PATCH 1/3] fixed files path --- app/controllers/index.js | 6 ++++++ config/config.js | 11 ++++++----- config/express.js | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/controllers/index.js b/app/controllers/index.js index 9f6a7d75..a31286de 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -1,11 +1,17 @@ 'use strict'; +var config = require('../../config/config'); + var _getVersion = function() { var pjson = require('../../package.json'); return pjson.version; }; exports.render = function(req, res) { + if (config.publicPath) { + return res.sendfile(config.publicPath + '/index.html'); + } + var version = _getVersion(); res.send('insight API v' + version); }; diff --git a/config/config.js b/config/config.js index 3be97dac..bb020097 100644 --- a/config/config.js +++ b/config/config.js @@ -10,14 +10,14 @@ var path = require('path'), if (process.env.INSIGHT_NETWORK === 'livenet') { env = 'livenet'; - db = './db'; + db = rootPath + '/db'; port = '3000'; b_port = '8332'; p2p_port = '8333'; } else { env = 'testnet'; - db = './db/testnet'; + db = rootPath + '/db/testnet'; port = '3001'; b_port = '18332'; p2p_port = '18333'; @@ -50,6 +50,7 @@ dataDir += network === 'testnet' ? 'testnet3' : ''; module.exports = { root: rootPath, + publicPath: process.env.INSIGHT_PUBLIC_PATH || false, appName: 'Insight ' + env, apiPrefix: '/api', port: port, @@ -68,11 +69,11 @@ module.exports = { network: network, disableP2pSync: false, disableHistoricSync: false, - poolMatchFile: './etc/minersPoolStrings.json', + poolMatchFile: rootPath + '/etc/minersPoolStrings.json', // Time to refresh the currency rate. In minutes currencyRefresh: 10, keys: { - segmentio: process.env.INSIGHT_SEGMENTIO_KEY - } + segmentio: process.env.INSIGHT_SEGMENTIO_KEY + } }; diff --git a/config/express.js b/config/express.js index 4072ebf9..4bf76418 100644 --- a/config/express.js +++ b/config/express.js @@ -37,8 +37,8 @@ module.exports = function(app, historicSync, peerSync) { app.use(express.methodOverride()); app.use(express.compress()); - if (process.env.INSIGHT_PUBLIC_PATH) { - var staticPath = path.normalize(config.rootPath + '/../../' + process.env.INSIGHT_PUBLIC_PATH); + if (config.publicPath) { + var staticPath = path.normalize(config.rootPath + '/../' + config.publicPath); //IMPORTANT: for html5mode, this line must to be before app.router app.use(express.static(staticPath)); From 2d1f3d8843da9f50c2ad73f4bad2cdfa9f8de4f7 Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Wed, 26 Feb 2014 16:28:32 -0300 Subject: [PATCH 2/3] new version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 43bb2b26..4df57439 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "insight-bitcore-api", "description": "An open-source bitcoin blockchain API. The Insight API provides you with a convenient, powerful and simple way to query and broadcast data on the bitcoin network and build your own services with it.", - "version": "0.1.2", + "version": "0.1.3", "author": { "name": "Ryan X Charles", "email": "ryan@bitpay.com" From 241fc73978ac136688c8797e27b8acda7ed62ddc Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Wed, 26 Feb 2014 16:32:36 -0300 Subject: [PATCH 3/3] updated README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0f827200..fe51d532 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ bitcoind must be running and must have finished downloading the blockchain **bef ## Quick Install Check the Prerequisites section above before installing. - To install Insight, clone the main repository: + To install Insight API, clone the main repository: - $ git clone git@github.com:bitpay/insight.git && cd insight + $ git clone git@github.com:bitpay/insight-api.git && cd insight-api Install dependencies: