mirror of
https://github.com/enso-org/enso.git
synced 2024-12-26 18:22:43 +03:00
15 lines
411 B
JavaScript
15 lines
411 B
JavaScript
export function require_env(name) {
|
|
return (
|
|
process.env[name] ??
|
|
(() => {
|
|
throw Error(`Missing ${name} environment variable.`)
|
|
})()
|
|
)
|
|
}
|
|
|
|
export function require_env_path_exist(name) {
|
|
const value = require_env(name)
|
|
if (path.existsSync(value)) return value
|
|
else throw Error(`File with path ${value} read from environment variable ${name} is missing.`)
|
|
}
|