Thank you for such an amazing tutorial!
I have a feeling that your accessEnv helper needs a little tweak. Since the main intention of this helper is to reduce the amount of accesses to process.env, you should check whether key is in process.env after confirming that the key is not already cached.
That seems like a proper logic.
check if key is cached
if not cached, check whether key is in process.env
if not found, check default value
if no default value, throw an error
Thank you for such an amazing tutorial! I have a feeling that your accessEnv helper needs a little tweak. Since the main intention of this helper is to reduce the amount of accesses to process.env, you should check whether
key
is inprocess.env
after confirming that the key is not already cached.That seems like a proper logic.