added environment switch for api server