fixed files path

This commit is contained in:
Mario Colque 2014-02-26 16:27:22 -03:00
parent 492abec636
commit 4d111a9853
3 changed files with 14 additions and 7 deletions

View File

@ -1,11 +1,17 @@
'use strict'; 'use strict';
var config = require('../../config/config');
var _getVersion = function() { var _getVersion = function() {
var pjson = require('../../package.json'); var pjson = require('../../package.json');
return pjson.version; return pjson.version;
}; };
exports.render = function(req, res) { exports.render = function(req, res) {
if (config.publicPath) {
return res.sendfile(config.publicPath + '/index.html');
}
var version = _getVersion(); var version = _getVersion();
res.send('insight API v' + version); res.send('insight API v' + version);
}; };

View File

@ -10,14 +10,14 @@ var path = require('path'),
if (process.env.INSIGHT_NETWORK === 'livenet') { if (process.env.INSIGHT_NETWORK === 'livenet') {
env = 'livenet'; env = 'livenet';
db = './db'; db = rootPath + '/db';
port = '3000'; port = '3000';
b_port = '8332'; b_port = '8332';
p2p_port = '8333'; p2p_port = '8333';
} }
else { else {
env = 'testnet'; env = 'testnet';
db = './db/testnet'; db = rootPath + '/db/testnet';
port = '3001'; port = '3001';
b_port = '18332'; b_port = '18332';
p2p_port = '18333'; p2p_port = '18333';
@ -50,6 +50,7 @@ dataDir += network === 'testnet' ? 'testnet3' : '';
module.exports = { module.exports = {
root: rootPath, root: rootPath,
publicPath: process.env.INSIGHT_PUBLIC_PATH || false,
appName: 'Insight ' + env, appName: 'Insight ' + env,
apiPrefix: '/api', apiPrefix: '/api',
port: port, port: port,
@ -68,11 +69,11 @@ module.exports = {
network: network, network: network,
disableP2pSync: false, disableP2pSync: false,
disableHistoricSync: false, disableHistoricSync: false,
poolMatchFile: './etc/minersPoolStrings.json', poolMatchFile: rootPath + '/etc/minersPoolStrings.json',
// Time to refresh the currency rate. In minutes // Time to refresh the currency rate. In minutes
currencyRefresh: 10, currencyRefresh: 10,
keys: { keys: {
segmentio: process.env.INSIGHT_SEGMENTIO_KEY segmentio: process.env.INSIGHT_SEGMENTIO_KEY
} }
}; };

View File

@ -37,8 +37,8 @@ module.exports = function(app, historicSync, peerSync) {
app.use(express.methodOverride()); app.use(express.methodOverride());
app.use(express.compress()); app.use(express.compress());
if (process.env.INSIGHT_PUBLIC_PATH) { if (config.publicPath) {
var staticPath = path.normalize(config.rootPath + '/../../' + process.env.INSIGHT_PUBLIC_PATH); var staticPath = path.normalize(config.rootPath + '/../' + config.publicPath);
//IMPORTANT: for html5mode, this line must to be before app.router //IMPORTANT: for html5mode, this line must to be before app.router
app.use(express.static(staticPath)); app.use(express.static(staticPath));