Apply patch from perillamint on github
All checks were successful
continuous-integration/drone/push Build is passing

Show repository URL with commit reference
This commit is contained in:
asonix 2023-01-01 09:47:21 -06:00
parent 5f5c34640f
commit f291b24269

View file

@ -58,6 +58,7 @@ pub struct Config {
base_uri: IriAbsoluteString, base_uri: IriAbsoluteString,
sled_path: PathBuf, sled_path: PathBuf,
source_repo: IriString, source_repo: IriString,
source_url: IriString,
opentelemetry_url: Option<IriString>, opentelemetry_url: Option<IriString>,
telegram_token: Option<String>, telegram_token: Option<String>,
telegram_admin_handle: Option<String>, telegram_admin_handle: Option<String>,
@ -203,6 +204,11 @@ impl Config {
(None, None) => None, (None, None) => None,
}; };
let source_url = match Self::git_hash() {
Some(hash) => format!("{}/tree/{}", config.source_repo, hash).parse().unwrap(),
None => config.source_repo.clone()
};
Ok(Config { Ok(Config {
hostname: config.hostname, hostname: config.hostname,
addr: config.addr, addr: config.addr,
@ -214,6 +220,7 @@ impl Config {
base_uri, base_uri,
sled_path: config.sled_path, sled_path: config.sled_path,
source_repo: config.source_repo, source_repo: config.source_repo,
source_url,
opentelemetry_url: config.opentelemetry_url, opentelemetry_url: config.opentelemetry_url,
telegram_token: config.telegram_token, telegram_token: config.telegram_token,
telegram_admin_handle: config.telegram_admin_handle, telegram_admin_handle: config.telegram_admin_handle,
@ -403,7 +410,7 @@ impl Config {
} }
pub(crate) fn source_code(&self) -> &IriString { pub(crate) fn source_code(&self) -> &IriString {
&self.source_repo &self.source_url
} }
pub(crate) fn opentelemetry_url(&self) -> Option<&IriString> { pub(crate) fn opentelemetry_url(&self) -> Option<&IriString> {