const _ = {
  pick: require('lodash.pick'),
};
const express = require('express');
const fs = require('fs');
const path = require('path');

module.exports = () => {
  const router = new express.Router();

  const version = require('@maxdome/version')();
  router.get('/version', (req, res) => {
    res.send(version);
  });

  let env = {};
  try {
    const keys = fs
      .readFileSync(path.join(process.cwd(), '.env.example'), 'utf-8')
      .split('\n')
      .map(line => {
        const matches = line.match(/([A-Z_]*)=.*? #info/);
        if (matches) {
          return matches[1];
        }
      })
      .filter(key => key);
    env = _.pick(process.env, keys);
  } catch (e) {
    if (e.code !== 'ENOENT') {
      throw e;
    }
  }
  
  router.get('/env', (req, res) => {
    res.send(env);
  });

  return router;
};

const _ = {
  pick: require('lodash.pick'),
};
const express = require('express');
const fs = require('fs');
const path = require('path');

module.exports = () => {
  const router = new express.Router();
  const version = require('@maxdome/version')();
  router.get('/version', (req, res) => {
    res.send(version);
  });
  let env = process.env;
  try {
    const keys = fs
      .readFileSync(path.join(process.cwd(), '.env.example'), 'utf-8')
      .split('\n')
      .map(line => {
        const matches = line.match(/([A-Z_]*)=.*? #info/);
        if (matches) {
          return matches[1];
        }
      })
      .filter(key => key);
    env = _.pick(env, keys);
  } catch (e) {
    if (e.code !== 'ENOENT') {
      throw e;
    }
  }
  router.get('/env', (req, res) => {
    res.send(env);
  });
  return router;
};

--- 
+++ 
@@ -7,13 +7,11 @@
 
 module.exports = () => {
   const router = new express.Router();
-
   const version = require('@maxdome/version')();
   router.get('/version', (req, res) => {
     res.send(version);
   });
-
-  let env = {};
+  let env = process.env;
   try {
     const keys = fs
       .readFileSync(path.join(process.cwd(), '.env.example'), 'utf-8')
@@ -25,16 +23,14 @@
         }
       })
       .filter(key => key);
-    env = _.pick(process.env, keys);
+    env = _.pick(env, keys);
   } catch (e) {
     if (e.code !== 'ENOENT') {
       throw e;
     }
   }
-  
   router.get('/env', (req, res) => {
     res.send(env);
   });
-
   return router;
 };
Remove default output of all env vars
