From 2b1c3d56d19e2a0a3b6d0a5c7b95d5bdee3b30a2 Mon Sep 17 00:00:00 2001 From: Sulka Haro Date: Sat, 27 Jul 2019 11:19:03 +0300 Subject: [PATCH 1/2] Assume any string in DISPLAY_UNITS that contains "mmol" indicates mmol and ensure mg/dl is right if the setting is not mmol --- env.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/env.js b/env.js index cb200d59de5..bdbd7aa91c8 100644 --- a/env.js +++ b/env.js @@ -21,6 +21,15 @@ function config ( ) { * See README.md for info about all the supported ENV VARs */ env.DISPLAY_UNITS = readENV('DISPLAY_UNITS', 'mg/dl'); + + // be lenient at accepting the mmol input + if (env.DISPLAY_UNITS.toLowerCase().includes('mmol')) { + env.DISPLAY_UNITS = 'mmol'; + } else { + // also ensure the mg/dl is set with expected case + env.DISPLAY_UNITS = 'mg/dl'; + } + env.PORT = readENV('PORT', 1337); env.HOSTNAME = readENV('HOSTNAME', null); env.IMPORT_CONFIG = readENV('IMPORT_CONFIG', null); From e7ac8438469097c9477f2b76ebac6080dc8c0a28 Mon Sep 17 00:00:00 2001 From: Sulka Haro Date: Sat, 27 Jul 2019 11:48:50 +0300 Subject: [PATCH 2/2] Add startup logging for the value --- env.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/env.js b/env.js index bdbd7aa91c8..9114e7297fc 100644 --- a/env.js +++ b/env.js @@ -30,6 +30,8 @@ function config ( ) { env.DISPLAY_UNITS = 'mg/dl'; } + console.log('Units set to', env.DISPLAY_UNITS ); + env.PORT = readENV('PORT', 1337); env.HOSTNAME = readENV('HOSTNAME', null); env.IMPORT_CONFIG = readENV('IMPORT_CONFIG', null);