From 1299a3e3649be4ffeb0fbc7851c4c5840fbf7fe4 Mon Sep 17 00:00:00 2001 From: jonrobins Date: Fri, 6 Jul 2018 09:06:18 +0100 Subject: [PATCH] added functionality to override version number in info endpoint --- README.md | 6 ++++++ controllers/info.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 510ae00..9ec1ebf 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,12 @@ In the above example the application would be accessible at the following addres Note: the `registrationNetworkInterfacePriority` property allows the selection of the network interface when dynamically registering a service with ZooKeeper. +If you would like to override the version which is exposed in the /info endpoint, just set the VERSION node env variable. + +```sh +VERSION=1.0.1 node index.js +``` + ## API ```javascript diff --git a/controllers/info.js b/controllers/info.js index 03ec48e..b26b266 100644 --- a/controllers/info.js +++ b/controllers/info.js @@ -15,7 +15,7 @@ module.exports = function (router) { res.json({ "build": { "description": packageInfo.description, - "version": packageInfo.version, + "version": process.env.VERSION || packageInfo.version, "name": packageInfo.name } });