module: eliminate double `getenv()`

`process.env` access results in a synchronous `getenv` call. Cache the
first result instead and save one syscall.