Rename public factory function
This commit is contained in:
parent
92ba322214
commit
5c95ee0daa
3
app.js
3
app.js
@ -14,6 +14,7 @@
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
const fqdn = require('@carto/fqdn-sync');
|
const fqdn = require('@carto/fqdn-sync');
|
||||||
|
const serverFactory = require('./app/server');
|
||||||
|
|
||||||
var argv = require('yargs')
|
var argv = require('yargs')
|
||||||
.usage('Usage: $0 <environment> [options]')
|
.usage('Usage: $0 <environment> [options]')
|
||||||
@ -92,7 +93,7 @@ if (global.settings.statsd) {
|
|||||||
}
|
}
|
||||||
var statsClient = StatsClient.getInstance(global.settings.statsd);
|
var statsClient = StatsClient.getInstance(global.settings.statsd);
|
||||||
|
|
||||||
var server = require('./app/server')(statsClient);
|
var server = serverFactory(statsClient);
|
||||||
var listener = server.listen(global.settings.node_port, global.settings.node_host);
|
var listener = server.listen(global.settings.node_port, global.settings.node_host);
|
||||||
listener.on('listening', function() {
|
listener.on('listening', function() {
|
||||||
console.info("Using Node.js %s", process.version);
|
console.info("Using Node.js %s", process.version);
|
||||||
|
@ -3,15 +3,12 @@
|
|||||||
const express = require('express');
|
const express = require('express');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const mkdirp = require('mkdirp');
|
const mkdirp = require('mkdirp');
|
||||||
|
|
||||||
const RedisPool = require('redis-mpool');
|
const RedisPool = require('redis-mpool');
|
||||||
const cartodbRedis = require('cartodb-redis');
|
const cartodbRedis = require('cartodb-redis');
|
||||||
const Logger = require('./services/logger');
|
const Logger = require('./services/logger');
|
||||||
|
|
||||||
const ApiRouter = require('./controllers/api-router');
|
const ApiRouter = require('./controllers/api-router');
|
||||||
const HealthCheckController = require('./controllers/health_check_controller');
|
const HealthCheckController = require('./controllers/health_check_controller');
|
||||||
const VersionController = require('./controllers/version_controller');
|
const VersionController = require('./controllers/version_controller');
|
||||||
|
|
||||||
const batchFactory = require('../batch');
|
const batchFactory = require('../batch');
|
||||||
|
|
||||||
process.env.PGAPPNAME = process.env.PGAPPNAME || 'cartodb_sqlapi';
|
process.env.PGAPPNAME = process.env.PGAPPNAME || 'cartodb_sqlapi';
|
||||||
@ -20,7 +17,7 @@ process.env.PGAPPNAME = process.env.PGAPPNAME || 'cartodb_sqlapi';
|
|||||||
require('./utils/date_to_json');
|
require('./utils/date_to_json');
|
||||||
|
|
||||||
// jshint maxcomplexity:9
|
// jshint maxcomplexity:9
|
||||||
function App(statsClient) {
|
module.exports = function serverFactory (statsClient) {
|
||||||
const app = express();
|
const app = express();
|
||||||
const redisPool = new RedisPool({
|
const redisPool = new RedisPool({
|
||||||
name: 'sql-api',
|
name: 'sql-api',
|
||||||
@ -87,5 +84,3 @@ function App(statsClient) {
|
|||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = App;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user