diff --git a/lib/server-options.js b/lib/server-options.js index 5dc7b72d..ff011bac 100644 --- a/lib/server-options.js +++ b/lib/server-options.js @@ -58,48 +58,6 @@ var analysisConfig = _.defaults(global.environment.analysis || {}, { limits: {} }); -const routesConfig = global.environment.routes || { - api: [{ - paths: [ - '/api/v1', - '/user/:user/api/v1', - ], - // Base url for the Detached Maps API - // "/api/v1/map" is the new API, - map: [{ - paths: [ - '/map', - ] - }], - // Base url for the Templated Maps API - // "/api/v1/map/named" is the new API, - template: [{ - paths: [ - '/map/named' - ] - }] - }] -}; - -if (routesConfig.v1 && !Array.isArray(routesConfig.v1)) { - routesConfig.api = [ routesConfig.v1 ]; - delete routesConfig.v1; -} - -if (routesConfig.api && !Array.isArray(routesConfig.api)) { - routesConfig.api = [ routesConfig.api ]; -} - -routesConfig.api.forEach(route => { - if (!Array.isArray(route.map)) { - route.map = [ route.map ]; - } - - if (!Array.isArray(route.template)) { - route.template = [ route.template ]; - } -}); - module.exports = { bind: { port: global.environment.port, @@ -108,7 +66,28 @@ module.exports = { // Base URLs for the APIs // // See http://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API - routes: routesConfig, + routes: global.environment.routes || { + api: [{ + paths: [ + '/api/v1', + '/user/:user/api/v1', + ], + // Base url for the Detached Maps API + // "/api/v1/map" is the new API, + map: [{ + paths: [ + '/map', + ] + }], + // Base url for the Templated Maps API + // "/api/v1/map/named" is the new API, + template: [{ + paths: [ + '/map/named' + ] + }] + }] + }, grainstore: { map: { // TODO: allow to specify in configuration