Use defer in reply
This commit is contained in:
parent
ed719aaf4f
commit
5077bad918
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1014,7 +1014,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kon"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
dependencies = [
|
||||
"bb8",
|
||||
"bb8-postgres",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kon"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,6 +1,5 @@
|
||||
FROM rust:1.80-alpine3.20 AS chef
|
||||
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
||||
ARG CARGO_TOKEN
|
||||
RUN apk add --no-cache openssl-dev musl-dev
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR /usr/src/kon
|
||||
@ -8,12 +7,16 @@ WORKDIR /usr/src/kon
|
||||
FROM chef AS planner
|
||||
COPY . .
|
||||
RUN mkdir -p .cargo && \
|
||||
printf '[registries.gitea]\nindex = "sparse+https://git.toast-server.net/api/packages/toast/cargo/"\ntoken = "Bearer %s"\n' "$CARGO_TOKEN" >> .cargo/config.toml
|
||||
printf '[registries.gitea]\nindex = "sparse+https://git.toast-server.net/api/packages/toast/cargo/"' >> .cargo/config.toml
|
||||
RUN cargo chef prepare
|
||||
|
||||
FROM chef AS builder
|
||||
FROM chef AS dependencies
|
||||
COPY --from=planner /usr/src/kon/recipe.json recipe.json
|
||||
RUN cargo chef cook --release
|
||||
|
||||
FROM chef AS builder
|
||||
COPY --from=planner /usr/src/kon/.cargo /usr/src/kon/.cargo
|
||||
COPY --from=dependencies /usr/src/kon/target /usr/src/kon/target
|
||||
COPY . .
|
||||
RUN cargo build -rF production
|
||||
|
||||
|
@ -66,6 +66,8 @@ struct Status {
|
||||
state: String
|
||||
}
|
||||
|
||||
const ILO_HOSTNAME: &str = "POMNI";
|
||||
|
||||
async fn ilo_data() -> Result<Chassis, ReqError> {
|
||||
let client = ClientBuilder::new()
|
||||
.danger_accept_invalid_certs(true)
|
||||
@ -94,6 +96,7 @@ pub async fn ilo(_: poise::Context<'_, (), Error>) -> Result<(), Error> {
|
||||
/// Retrieve data from the HP iLO4 interface
|
||||
#[poise::command(slash_command)]
|
||||
pub async fn temperature(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> {
|
||||
ctx.defer().await?;
|
||||
let data = ilo_data().await.unwrap();
|
||||
|
||||
let mut tempdata = String::new();
|
||||
@ -133,7 +136,7 @@ pub async fn temperature(ctx: poise::Context<'_, (), Error>) -> Result<(), Error
|
||||
CreateEmbed::new()
|
||||
.color(BINARY_PROPERTIES.embed_color)
|
||||
.timestamp(Timestamp::now())
|
||||
.title("POMNI - HP iLO4 Temperatures")
|
||||
.title(format!("{} - HP iLO4 Temperatures", ILO_HOSTNAME))
|
||||
.fields(vec![
|
||||
("Temperatures", tempdata, false),
|
||||
("Fans", fandata, false)
|
||||
|
Loading…
Reference in New Issue
Block a user