Juan Carlos 2021-03-03 07:58:05 -03:00 • committed by GitHub
commit 4982d1c662
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -5,9 +5,10 @@ when not declared(os) and not declared(ospaths):
when defined(nodejs):
proc getEnv*(key: string, default = ""): string {.tags: [ReadEnvEffect].} =
var ret: cstring
var ret = default.cstring
let key2 = key.cstring
{.emit: "`ret` = process.env[`key2`];".}
{.emit: "const value = process.env[`key2`];".}
{.emit: "if (value !== undefined) { `ret` = value };".}
result = $ret
proc existsEnv*(key: string): bool {.tags: [ReadEnvEffect].} =