Skip to content

Instantly share code, notes, and snippets.

@raine
Created January 29, 2020 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raine/8e5bfd8dda040ae56a71f8f5549efa92 to your computer and use it in GitHub Desktop.
Save raine/8e5bfd8dda040ae56a71f8f5549efa92 to your computer and use it in GitHub Desktop.
function getFromEnv(prop: string): string {
const val = process.env[prop]
if (val) {
return val
} else {
throw new Error(`Expected ${prop} to exist in env`)
}
}
type Config = {
GOOGLE_APPLICATION_CREDENTIALS: string
}
const config: Config = {
GOOGLE_APPLICATION_CREDENTIALS: getFromEnv('GOOGLE_APPLICATION_CREDENTIALS')
}
export default config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment