Move flag handling out of config into main

This places all the flag definitions together, making them easier to find, and makes it possible (in the future) to use db for convenience functions when we have a Go API, without having flag space contaminated by cayley main flags.