From 4a4675ab045f13579d35ea1fc461e11e080bbe2c Mon Sep 17 00:00:00 2001 From: punkish Date: Fri, 8 May 2020 14:47:39 +0200 Subject: [PATCH] added a config setting called root for the correct root url from outside --- api/v2/resources/rootRoute.js | 5 ++++- config/default.js | 1 + config/production.js | 3 +-- config/test.js | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/api/v2/resources/rootRoute.js b/api/v2/resources/rootRoute.js index a3f199c..2a148a4 100644 --- a/api/v2/resources/rootRoute.js +++ b/api/v2/resources/rootRoute.js @@ -1,5 +1,8 @@ 'use strict'; +const config = require('config'); +const root = config.get('root'); + /************************************************************* * * This is the root of the API. It lists all the routes to the @@ -32,7 +35,7 @@ module.exports = { return { name: name, description: description, - path: `${server.info.uri}${path}` + path: `${root}${path}` } }); diff --git a/config/default.js b/config/default.js index 67cddbb..3e30636 100644 --- a/config/default.js +++ b/config/default.js @@ -23,6 +23,7 @@ module.exports = { // The port can change depending on the server port: 3030, + root: 'http://localhost:3030', loglevel: 'INFO', diff --git a/config/production.js b/config/production.js index 02179f5..57dcf85 100644 --- a/config/production.js +++ b/config/production.js @@ -7,11 +7,10 @@ * **************************************************************/ -const host = 'https://zenodeo.org'; - module.exports = { loglevel: 'ERROR', + root: 'https://zenodeo.org', v1: { uri: { diff --git a/config/test.js b/config/test.js index 0652183..ed86d58 100644 --- a/config/test.js +++ b/config/test.js @@ -10,6 +10,7 @@ module.exports = { loglevel: 'ERROR', + root: 'http://z2.punkish.org', v1: { uri: {