MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / command_service_url

Function command_service_url

packages/server/src/main.rs:1205–1222  ·  view source on GitHub ↗
(explicit: Option<&str>)

Source from the content-addressed store, hash-verified

1203}
1204
1205fn command_service_url(explicit: Option<&str>) -> anyhow::Result<String> {
1206 if let Some(url) = explicit
1207 .map(ToOwned::to_owned)
1208 .or_else(|| env::var("SIMDECK_SERVER_URL").ok())
1209 .filter(|value| !value.trim().is_empty())
1210 {
1211 return Ok(url);
1212 }
1213 if let Some(result) = service::active()? {
1214 return Ok(http_url_for_host("127.0.0.1", result.port));
1215 }
1216 if let Some(metadata) = read_service_metadata().ok().flatten() {
1217 if service_is_healthy(&metadata) {
1218 return Ok(metadata.http_url);
1219 }
1220 }
1221 Ok(ensure_singleton_service(ServiceLaunchOptions::default())?.http_url)
1222}
1223
1224fn command_service_url_for_udid(
1225 udid: &str,

Callers 4

resolve_cli_device_udidFunction · 0.85
mainFunction · 0.85

Calls 6

activeFunction · 0.85
http_url_for_hostFunction · 0.85
read_service_metadataFunction · 0.85
service_is_healthyFunction · 0.85
ensure_singleton_serviceFunction · 0.85
is_emptyMethod · 0.80

Tested by

no test coverage detected