Skip to content

Commit

Permalink
Add back in build data
Browse files Browse the repository at this point in the history
  • Loading branch information
Hampton Moore committed Jan 16, 2024
1 parent 87d3423 commit ad2ff3a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ FROM debian:bullseye-slim
RUN apt-get update
RUN apt-get install pkg-config libssl-dev -y

ARG REF=""
ARG COMMIT=""
ARG TIME=""

ENV COMMIT=${COMMIT}
ENV REF=${REF}
ENV TIME=${TIME}
Expand Down
20 changes: 17 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use axum::{
extract::Request,
middleware::{self, Next},
response::Html,
response::Response,
routing::get,
Router,
Expand All @@ -12,6 +11,7 @@ use axum_extra::extract::cookie::CookieJar;
use log::{error, info};
use std::sync::Arc;
use tokio::sync::RwLock;
use maud::{Markup, html};

use tower_http::services::ServeDir;
mod site;
Expand All @@ -20,8 +20,22 @@ mod update;
mod utils;
mod words;

async fn health() -> Html<String> {
Html(String::from("OK"))
async fn health() -> Markup {
let build_info = format!("Built on: {} • Ref: {} • Commit: {} • CT: {}",
std::env::var("TIME").unwrap_or_else(|_| String::from("Unknown")),
std::env::var("REF").unwrap_or_else(|_| String::from("Unknown")),
std::env::var("COMMIT").unwrap_or_else(|_| String::from("Unknown")),
std::env::var("CT").unwrap_or_else(|_| String::from("Unknown")),
);

html! {
h1 { "Ok"}
div class="pure-g hero section" {
div class="pure-u-1" {
p { (build_info) }
}
}
}
}

#[derive(Debug, Clone)]
Expand Down

0 comments on commit ad2ff3a

Please sign in to comment.