1use std::env;
3
4#[derive(Debug, Clone)]
5pub struct BaseStore {
6 pub site_name: String,
8 pub body_embed: String,
10 pub starstraw: String,
12 pub static_dir: String,
14 pub nested: String,
16}
17
18impl BaseStore {
19 pub fn new() -> Self {
20 Self {
21 site_name: match env::var("PO_SITE_NAME") {
22 Ok(s) => s,
23 Err(_) => String::from("Pongo"),
24 },
25 body_embed: match env::var("PO_BODY_EMBED") {
26 Ok(s) => s,
27 Err(_) => String::new(),
28 },
29 starstraw: match env::var("PO_STARSTRAW") {
30 Ok(s) => s,
31 Err(_) => panic!("Starstraw is required to use Pongo."),
32 },
33 static_dir: match env::var("PO_STATIC_DIR") {
34 Ok(s) => s,
35 Err(_) => {
36 panic!("No static dir has been provided! Pongo needs client files to function.")
37 }
38 },
39 nested: match env::var("PO_NESTED") {
40 Ok(s) => s,
41 Err(_) => String::from("@pongo"),
42 },
43 }
44 }
45}