Use the general opt_set_charp functions for setting api parameters
Generalise a lot more of the command line options simplifying the write config function and making it write far more values unaided