bundle in the last commit hash

This commit is contained in:
blek 2023-10-09 20:50:18 +10:00
parent 73739b5bc4
commit a2bc80d501
Signed by: blek
GPG Key ID: 14546221E3595D0C
3 changed files with 40 additions and 10 deletions

39
filed/Cargo.lock generated
View File

@ -58,7 +58,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn",
"syn 2.0.37",
]
[[package]]
@ -170,6 +170,17 @@ dependencies = [
"memchr",
]
[[package]]
name = "compile-time-run"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b5affba7c91c039a483065125dd8c6d4a0985e1e9ac5ab6dffdea4fe4e637f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.4"
@ -258,6 +269,7 @@ dependencies = [
"askama",
"bytes",
"chrono",
"compile-time-run",
"dotenvy",
"femme",
"futures-util",
@ -311,7 +323,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.37",
]
[[package]]
@ -779,7 +791,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.37",
]
[[package]]
@ -908,7 +920,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.37",
]
[[package]]
@ -1074,6 +1086,17 @@ dependencies = [
"sval_fmt",
]
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.37"
@ -1102,7 +1125,7 @@ checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.37",
]
[[package]]
@ -1145,7 +1168,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.37",
]
[[package]]
@ -1401,7 +1424,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn",
"syn 2.0.37",
"wasm-bindgen-shared",
]
@ -1423,7 +1446,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.37",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

View File

@ -9,6 +9,7 @@ edition = "2021"
askama = "0.12.0"
bytes = "1.5.0"
chrono = { version = "0.4.31", features = ["serde"] }
compile-time-run = "0.2.12"
dotenvy = "0.15.7"
femme = "2.2.1"
futures-util = "0.3.28"

View File

@ -5,6 +5,10 @@
use std::{env::var, net::SocketAddr, path::Path, fs};
use compile_time_run::run_command_str;
const LAST_COMMIT: &'static str = run_command_str!("git", "--no-pager", "log", "--pretty=format:%H", "-1");
#[derive(Debug, Clone)]
pub struct Redis {
pub pass: String,
@ -20,7 +24,8 @@ pub struct Env {
pub redis: Redis,
pub filedir: String,
pub instanceurl: String,
pub uploadspath: String
pub uploadspath: String,
pub last_commit: &'static str
}
fn get_var<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> {
@ -55,7 +60,8 @@ pub fn loadenv() -> Result<Env, Box<dyn std::error::Error>> {
spath
},
instanceurl: get_var("INSTANCE_URL")?,
uploadspath: get_var("UPLOADS_PATH")?
uploadspath: get_var("UPLOADS_PATH")?,
last_commit: LAST_COMMIT
}
)
}