[OnDemand] Tidy up DNS construction

Change the code to format the config DNS params.