mirror of
https://github.com/moghtech/komodo.git
synced 2026-03-11 17:44:19 -05:00
test periphery api
This commit is contained in:
@@ -228,6 +228,8 @@ pub struct DockerContainerStats {
|
||||
EnumString,
|
||||
MungosIndexed,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum DockerContainerState {
|
||||
#[default]
|
||||
Unknown,
|
||||
|
||||
@@ -39,7 +39,7 @@ pub async fn guard_request_by_passkey(
|
||||
format!("failed to get passkey from authorization header as str: {e:?}"),
|
||||
)
|
||||
})?
|
||||
.to_string();
|
||||
.replace("Bearer ", "");
|
||||
if state.config.passkeys.contains(&req_passkey) {
|
||||
Ok(next.run(req).await)
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use anyhow::anyhow;
|
||||
use anyhow::{anyhow, Context};
|
||||
use bollard::{container::ListContainersOptions, Docker};
|
||||
use monitor_types::entities::{
|
||||
deployment::BasicContainerInfo,
|
||||
@@ -38,7 +38,11 @@ impl DockerClient {
|
||||
.ok_or(anyhow!("no names on container (empty vec)"))?
|
||||
.replace('/', ""),
|
||||
image: s.image.unwrap_or(String::from("unknown")),
|
||||
state: s.state.unwrap().parse().unwrap(),
|
||||
state: s
|
||||
.state
|
||||
.context("no container state")?
|
||||
.parse()
|
||||
.context("failed to parse container state")?,
|
||||
status: s.status,
|
||||
};
|
||||
Ok::<_, anyhow::Error>(info)
|
||||
|
||||
@@ -43,7 +43,7 @@ async fn app() -> anyhow::Result<()> {
|
||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("{e:?}")))
|
||||
})
|
||||
.await
|
||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("{e:?}")));
|
||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("{e:#?}")));
|
||||
if let Err(e) = &res {
|
||||
debug!("request {req_id} SPAWN ERROR: {e:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user