Compare commits

...

2 commits

Author SHA1 Message Date
asonix 1df3042a1d Bump deps, version 2021-02-11 22:13:42 -06:00
asonix d6fa5d3617 Expose source_repo env var 2021-02-11 22:11:55 -06:00
3 changed files with 11 additions and 7 deletions

8
Cargo.lock generated
View file

@ -715,9 +715,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.8.2"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f"
dependencies = [
"atty",
"humantime 2.1.0",
@ -1761,7 +1761,7 @@ checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
[[package]]
name = "relay"
version = "0.2.9"
version = "0.2.10"
dependencies = [
"activitystreams",
"activitystreams-ext",
@ -1777,7 +1777,7 @@ dependencies = [
"chrono",
"config",
"dotenv",
"env_logger 0.8.2",
"env_logger 0.8.3",
"futures",
"http-signature-normalization-actix",
"log",

View file

@ -1,7 +1,7 @@
[package]
name = "relay"
description = "A simple activitypub relay"
version = "0.2.9"
version = "0.2.10"
authors = ["asonix <asonix@asonix.dog>"]
license-file = "LICENSE"
readme = "README.md"

View file

@ -23,6 +23,7 @@ pub(crate) struct ParsedConfig {
pretty_log: bool,
publish_blocks: bool,
sled_path: PathBuf,
source_repo: Url,
}
#[derive(Clone, Debug)]
@ -37,6 +38,7 @@ pub struct Config {
publish_blocks: bool,
base_uri: Url,
sled_path: PathBuf,
source_repo: Url,
}
pub enum UrlKind {
@ -66,6 +68,7 @@ impl Config {
.set_default("pretty_log", true)?
.set_default("publish_blocks", false)?
.set_default("sled_path", "./sled/db-0-34")?
.set_default("source_repo", "https://git.asonix.dog/asonix/relay")?
.merge(Environment::new())?;
let config: ParsedConfig = config.try_into()?;
@ -84,6 +87,7 @@ impl Config {
publish_blocks: config.publish_blocks,
base_uri,
sled_path: config.sled_path,
source_repo: config.source_repo,
})
}
@ -152,8 +156,8 @@ impl Config {
"v0.2.0-main".to_owned()
}
pub(crate) fn source_code(&self) -> String {
"https://git.asonix.dog/asonix/ap-relay".to_owned()
pub(crate) fn source_code(&self) -> &Url {
&self.source_repo
}
pub(crate) fn generate_url(&self, kind: UrlKind) -> Url {