Refactor getting the key from os.environ.