-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvVarsDefinition.ts
More file actions
27 lines (24 loc) · 921 Bytes
/
envVarsDefinition.ts
File metadata and controls
27 lines (24 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* ENV Var Loading, Validation & Definition
*
* @export publicEnvVars object
* @export secretEnvVars object
* @throw EnvVarError if validation fails
**/
import * as envVar from 'env-var' // env validation library
import { envLoad } from './envLoader'
// ==== 1. load correct env
envLoad()
// ==== 2. validate env vars and redefine them
// ----------------------------------------------------------------
// PUBLIC ENV VARs
// ----------------------------------------------------------------
export const publicEnvVars = {
appContext: envVar.get('APP_CONTEXT').required().asString(),
nodeEnv: envVar.get('NODE_ENV').asString(), // can't be required since AWS lambda functions don't have it
}
// ----------------------------------------------------------------
// SECRET ENV VARs
// for use in backend code
// ----------------------------------------------------------------
export const secretEnvVars = {}