From 6bc23f04daf985e8cac901754ee9dd297aa00004 Mon Sep 17 00:00:00 2001 From: Ivar Date: Thu, 7 Sep 2017 21:42:21 +0200 Subject: [PATCH] Added option to disable legacy routes. Closes #244 --- docs/getting-started.md | 5 +++-- lib/options.js | 1 + lib/routes/index.js | 4 +++- lib/routes/index.test.js | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index b2910f32a3..2d237c00ed 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -35,8 +35,9 @@ unleash.start({ Available unleash options includes: -- databaseUrl -- port +- **databaseUrl** - the postgress database url to connect to. Should include username/password. +- **port** - Which port should the unleash-server bind to? +- **enableLegacyRoutes** (boolean) - allows you to turn on/off support for legacy routes to support older clients. ## How do I configure the log output? diff --git a/lib/options.js b/lib/options.js index 72362fee0f..ae2aba1e4b 100644 --- a/lib/options.js +++ b/lib/options.js @@ -9,6 +9,7 @@ const DEFAULT_OPTIONS = { port: process.env.HTTP_PORT || process.env.PORT || 4242, baseUriPath: process.env.BASE_URI_PATH || '', serverMetrics: true, + enableLegacyRoutes: true, publicFolder, enableRequestLogger: isDev(), }; diff --git a/lib/routes/index.js b/lib/routes/index.js index 0d67bc029e..7e6290ee50 100644 --- a/lib/routes/index.js +++ b/lib/routes/index.js @@ -38,7 +38,9 @@ exports.router = function(config) { // $root/features // $root/client/register // $root/client/metrics - router.use('/api/features', clientFeatures.router(config)); + if (config.enableLegacyRoutes) { + router.use('/api/features', clientFeatures.router(config)); + } return router; }; diff --git a/lib/routes/index.test.js b/lib/routes/index.test.js index c1e91fbb3f..de45b64294 100644 --- a/lib/routes/index.test.js +++ b/lib/routes/index.test.js @@ -15,6 +15,7 @@ function getSetup() { baseUriPath: base, stores, eventBus, + enableLegacyRoutes: true, }); return {