Revert "Remove outdated environment APIs"

This reverts commit 086cc59387731b64d3b81ab7d3ec210983f617ea.