Factor out some config parsing into its own function.