Merge pull request #1130 from CartoDB/remove-routes-adapter

Remove environment configuration adapter
This commit is contained in:
Daniel G. Aubert 2019-10-08 16:34:24 +02:00 committed by GitHub
commit c40c42fc10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,15 @@ var analysisConfig = _.defaults(global.environment.analysis || {}, {
limits: {} limits: {}
}); });
const routesConfig = global.environment.routes || { module.exports = {
bind: {
port: global.environment.port,
host: global.environment.host
},
// Base URLs for the APIs
//
// See http://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
routes: global.environment.routes || {
api: [{ api: [{
paths: [ paths: [
'/api/v1', '/api/v1',
@ -79,36 +87,7 @@ const routesConfig = global.environment.routes || {
] ]
}] }]
}] }]
};
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,
host: global.environment.host
}, },
// Base URLs for the APIs
//
// See http://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
routes: routesConfig,
grainstore: { grainstore: {
map: { map: {
// TODO: allow to specify in configuration // TODO: allow to specify in configuration