client: improve configuration generator
client: improve configuration generator

Clean up the configuration generator function, handle some error
conditions better and make the output a bit nicer.

mozilla/mig,mozilla/mig,mozilla/mig,mozilla/mig,ameihm0912/mig,ameihm0912/mig,ameihm0912/mig,mozilla/mig