DRY up environment attribute logic.