Reorg config

Add a configuration library, to start to move command line arguments into config or environment variables.