diff options
Diffstat (limited to 'splorm/src/config.rs')
| -rw-r--r-- | splorm/src/config.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/splorm/src/config.rs b/splorm/src/config.rs index 9c5a86c..09e6171 100644 --- a/splorm/src/config.rs +++ b/splorm/src/config.rs @@ -78,6 +78,10 @@ impl Config { let templates: Utf8PathBuf = templates_sec.parse().unwrap(); let default_template = templates_sec.child_owned("Default").unwrap(); + let opengraph = serving.child("Opengraph").unwrap(); + let og_image = opengraph.child_owned("DefaultImage").unwrap(); + let og_image_alt = opengraph.get_delim("DefaultImage/Text", '/').unwrap(); + let wikarden_sec = serving.child("Wikarden").unwrap(); let wikarden_root = wikarden_sec.parse().unwrap(); let wikarden_index = wikarden_sec.child_owned("Index").unwrap(); @@ -101,6 +105,11 @@ impl Config { default_template, template_dir: templates, // webroot.join(templates), + opengraph: Opengraph { + image: og_image, + image_alt: og_image_alt.to_owned(), + }, + hostname, webroot, @@ -147,6 +156,8 @@ pub struct Settings { default_template: String, template_dir: Utf8PathBuf, + opengraph: Opengraph, + wikarden_root: Utf8PathBuf, wikarden_index: String, wikarden_gitname: String, @@ -221,6 +232,10 @@ impl Settings { &self.database_path } + pub fn opengraph(&self) -> &Opengraph { + &self.opengraph + } + pub fn connectors(&self) -> &Connectors { &self.connectors } @@ -249,3 +264,19 @@ pub fn create_tracing_subscriber() { ) .init(); } + +#[derive(Clone, Debug)] +pub struct Opengraph { + image: String, + image_alt: String, +} + +impl Opengraph { + pub fn default_image(&self) -> &str { + &self.image + } + + pub fn default_image_alt(&self) -> &str { + &self.image_alt + } +} |
