Add getEnvWithDefault

Here's the pull request! I added some docs, too. Feel free to change anything that isn't right.