Switch to env specified endpoint, with auto restart