MCPcopy Index your code
hub / github.com/Firstyear/opensuse-proxy-cache / do_main

Function do_main

opensuse-proxy-cache/src/main.rs:1701–2026  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1699}
1700
1701async fn do_main() {
1702 trace!("Trace working!");
1703 debug!("Debug working!");
1704
1705 let env_config = EnvConfig::parse();
1706
1707 let content_config = env_config
1708 .content_config_path
1709 .as_ref()
1710 .and_then(config::Config::parse);
1711
1712 debug!(?content_config);
1713
1714 let (mut backends, global_config) = if let Some(content_config) = content_config {
1715 let backends = content_config
1716 .prefix
1717 .into_iter()
1718 .map(|(prefix, backend_config)| {
1719 let config::Backend {
1720 url,
1721 cache_large_objects,
1722 wonder_guard,
1723 check_upstream,
1724 } = backend_config;
1725
1726 let prefix = if prefix.starts_with('/') {
1727 prefix
1728 } else {
1729 format!("/{}", prefix)
1730 };
1731
1732 Backend {
1733 provider: url,
1734 prefix,
1735 check_upstream,
1736 cache_large_objects,
1737 wonder_guard,
1738 online: AtomicBool::new(true),
1739 }
1740 })
1741 .collect();
1742
1743 (
1744 backends,
1745 GlobalConfig {
1746 allowed_countries: content_config.allowed_countries,
1747 daily_quota: content_config.daily_quota,
1748 },
1749 )
1750 } else {
1751 (Vec::new(), GlobalConfig::default())
1752 };
1753
1754 backends.sort_by_key(|be| be.prefix.clone());
1755 backends.reverse();
1756 debug!(?backends);
1757
1758 let default_backend_provider = if backends

Callers 1

mainFunction · 0.70

Calls 3

monitor_upstreamFunction · 0.85
prefetch_taskFunction · 0.85
handleMethod · 0.80

Tested by

no test coverage detected