mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 12:33:40 +00:00
appmgr: split bins update cargo.toml and .gitignore context appmgr: refactor error module appmgr: context begin new s9pk format appmgr: add fields to manifest appmgr: start action abstraction appmgr: volume abstraction appmgr: improved volumes appmgr: install wip appmgr: health daemon appmgr: health checks appmgr: wip config get appmgr: secret store wip appmgr: config rewritten appmgr: delete non-reusable code appmgr: wip appmgr: please the borrow-checker appmgr: technically runs now appmgr: cli appmgr: clean up cli appmgr: rpc-toolkit in action appmgr: wrap up config appmgr: account for updates during install appmgr: fix: #308 appmgr: impl Display for Version appmgr: cleanup appmgr: set dependents on install appmgr: dependency health checks
47 lines
1.2 KiB
Rust
47 lines
1.2 KiB
Rust
use emver::VersionRange;
|
|
use tokio_compat_02::FutureExt;
|
|
|
|
use crate::s9pk::manifest::Manifest;
|
|
use crate::{Error, ResultExt as _};
|
|
|
|
pub async fn manifest(id: &str, version: &VersionRange) -> Result<Manifest, Error> {
|
|
let manifest: Manifest = reqwest::get(&format!(
|
|
"{}/manifest/{}?spec={}",
|
|
&*crate::APP_REGISTRY_URL,
|
|
id,
|
|
version
|
|
))
|
|
.compat()
|
|
.await
|
|
.with_kind(crate::ErrorKind::Network)?
|
|
.error_for_status()
|
|
.with_kind(crate::ErrorKind::Registry)?
|
|
.json()
|
|
.await
|
|
.with_kind(crate::ErrorKind::Deserialization)?;
|
|
Ok(manifest)
|
|
}
|
|
|
|
pub async fn version(id: &str, version: &VersionRange) -> Result<emver::Version, Error> {
|
|
#[derive(serde::Deserialize)]
|
|
struct VersionRes {
|
|
version: emver::Version,
|
|
}
|
|
|
|
let version: VersionRes = reqwest::get(&format!(
|
|
"{}/version/{}?spec={}",
|
|
&*crate::APP_REGISTRY_URL,
|
|
id,
|
|
version
|
|
))
|
|
.compat()
|
|
.await
|
|
.with_kind(crate::ErrorKind::Network)?
|
|
.error_for_status()
|
|
.with_kind(crate::ErrorKind::Registry)?
|
|
.json()
|
|
.await
|
|
.with_kind(crate::ErrorKind::Deserialization)?;
|
|
Ok(version.version)
|
|
}
|