Add build script to make git version available in code
Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
parent
849ecbd5dc
commit
457c40bffe
3 changed files with 57 additions and 0 deletions
|
|
@ -23,6 +23,14 @@ use xmpp::jid::{BareJid, ResourcePart};
|
|||
|
||||
use crate::error::Error;
|
||||
|
||||
const MAYBE_VERSION: &'static str = include_str!(concat!(env!("OUT_DIR"), "/GIT_COMMIT"));
|
||||
const fn version() -> Option<&'static str> {
|
||||
match MAYBE_VERSION {
|
||||
v if v.is_empty() => None,
|
||||
v => Some(v),
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Config {
|
||||
/// Accounts trusted for admin tasks
|
||||
|
|
@ -50,6 +58,11 @@ pub struct Config {
|
|||
/// HTTP Webhook listening address and port, e.g., 127.0.0.1:1234 or [::1]:1234
|
||||
#[serde(default = "Config::default_addr")]
|
||||
pub addr: SocketAddr,
|
||||
|
||||
/// Software version
|
||||
#[serde(skip)]
|
||||
#[serde(default = "version")]
|
||||
pub version: Option<&'static str>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
|
|
|||
Loading…
Reference in a new issue