diff options
author | bob <bcz@cs.brown.edu> | 2019-12-09 10:16:58 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-12-09 10:16:58 -0500 |
commit | 2b5002cb19fd896426df2a26b981b99fb88dc119 (patch) | |
tree | d929ea2c4f761146367043c65125f7cd3f904535 /src/server/ApiManagers/UtilManager.ts | |
parent | e5ca273b70c2c41f953ad2a534afabdb313f3e99 (diff) | |
parent | cfaf02757f5aebd2ccce0bbef8b6f5e232932693 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/server/ApiManagers/UtilManager.ts')
-rw-r--r-- | src/server/ApiManagers/UtilManager.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/server/ApiManagers/UtilManager.ts b/src/server/ApiManagers/UtilManager.ts index 601a7d0d0..e959645e0 100644 --- a/src/server/ApiManagers/UtilManager.ts +++ b/src/server/ApiManagers/UtilManager.ts @@ -3,6 +3,7 @@ import { Method } from "../RouteManager"; import { exec } from 'child_process'; import { command_line } from "../ActionUtilities"; import RouteSubscriber from "../RouteSubscriber"; +import { red } from "colors"; export default class UtilManager extends ApiManager { @@ -11,7 +12,14 @@ export default class UtilManager extends ApiManager { register({ method: Method.GET, subscription: new RouteSubscriber("environment").add("key"), - onValidation: ({ req, res }) => res.send(process.env[req.params.key]) + onValidation: ({ req, res }) => { + const { key } = req.params; + const value = process.env[key]; + if (!value) { + console.log(red(`process.env.${key} is not defined.`)); + } + return res.send(value); + } }); register({ |