Make the config generation private method more generic