mirror of
https://github.com/goauthentik/authentik
synced 2026-04-26 01:25:02 +02:00
* packages/ak-lib: init Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> * fixup Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> --------- Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
21 lines
565 B
Rust
21 lines
565 B
Rust
//! Various utilities used by other crates
|
|
|
|
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
|
|
pub fn authentik_build_hash(fallback: Option<String>) -> String {
|
|
std::env::var("GIT_BUILD_HASH").unwrap_or_else(|_| fallback.unwrap_or_default())
|
|
}
|
|
|
|
pub fn authentik_full_version() -> String {
|
|
let build_hash = authentik_build_hash(None);
|
|
if build_hash.is_empty() {
|
|
VERSION.to_owned()
|
|
} else {
|
|
format!("{VERSION}+{build_hash}")
|
|
}
|
|
}
|
|
|
|
pub fn authentik_user_agent() -> String {
|
|
format!("authentik@{}", authentik_full_version())
|
|
}
|