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,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