use crate::utils::{generate_collection_executable_files, get_config, start_server_blocking};
pub fn run(name: &str, address: Option<&str>, port: Option<&u16>, protocol: Option<&str>) {
let config = get_config();
let collections = config.collections.as_deref().unwrap_or_default();
let collection = collections
.iter()
.find(|collection| collection.name == *name);
if let Some(collection) = collection {
generate_collection_executable_files(&config, collection);
start_server_blocking(&config, collection, address, port, protocol);
} else {
panic!("Collection not found in the workspace.")
}
}