Rename public factory function

This commit is contained in:
Daniel García Aubert 2019-10-01 15:50:05 +02:00
parent 92ba322214
commit 5c95ee0daa
2 changed files with 3 additions and 7 deletions

3
app.js
View File

@ -14,6 +14,7 @@
var fs = require('fs');
var path = require('path');
const fqdn = require('@carto/fqdn-sync');
const serverFactory = require('./app/server');
var argv = require('yargs')
.usage('Usage: $0 <environment> [options]')
@ -92,7 +93,7 @@ if (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);
listener.on('listening', function() {
console.info("Using Node.js %s", process.version);

View File

@ -3,15 +3,12 @@
const express = require('express');
const fs = require('fs');
const mkdirp = require('mkdirp');
const RedisPool = require('redis-mpool');
const cartodbRedis = require('cartodb-redis');
const Logger = require('./services/logger');
const ApiRouter = require('./controllers/api-router');
const HealthCheckController = require('./controllers/health_check_controller');
const VersionController = require('./controllers/version_controller');
const batchFactory = require('../batch');
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');
// jshint maxcomplexity:9
function App(statsClient) {
module.exports = function serverFactory (statsClient) {
const app = express();
const redisPool = new RedisPool({
name: 'sql-api',
@ -87,5 +84,3 @@ function App(statsClient) {
return app;
}
module.exports = App;