2022-03-01 14:24:17 +00:00
|
|
|
use byte_unit::Byte;
|
|
|
|
|
2022-07-19 19:55:05 +00:00
|
|
|
// Internal
|
2022-03-01 14:24:17 +00:00
|
|
|
lazy_static! {
|
2022-07-16 12:16:54 +00:00
|
|
|
pub static ref VERSION: String = option_env!("CARGO_PKG_VERSION")
|
|
|
|
.unwrap_or("Unknown")
|
|
|
|
.to_string();
|
2022-07-19 19:55:05 +00:00
|
|
|
pub static ref FRONTEND_PATH: String =
|
|
|
|
std::env::var("FRONTEND_PATH").unwrap_or("../frontend/build".to_string());
|
|
|
|
pub static ref LISTEN_ADDR: String =
|
2023-01-13 18:36:26 +00:00
|
|
|
std::env::var("LISTEN_ADDR").unwrap_or("0.0.0.0:8000".to_string());
|
2022-10-07 19:28:25 +00:00
|
|
|
pub static ref VERBOSITY: String = std::env::var("VERBOSITY").unwrap_or("warn".to_string());
|
2022-07-16 12:16:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// CONFIG
|
|
|
|
lazy_static! {
|
2024-03-15 14:26:33 +00:00
|
|
|
pub static ref LIMIT: usize =
|
|
|
|
Byte::from_str(std::env::var("SIZE_LIMIT").unwrap_or("1 KiB".to_string()))
|
|
|
|
.unwrap()
|
|
|
|
.get_bytes() as usize;
|
|
|
|
pub static ref MAX_VIEWS: u32 = std::env::var("MAX_VIEWS")
|
|
|
|
.unwrap_or("100".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
|
|
|
pub static ref MAX_EXPIRATION: u32 = std::env::var("MAX_EXPIRATION")
|
|
|
|
.unwrap_or("360".to_string()) // 6 hours in minutes
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
|
|
|
pub static ref ALLOW_ADVANCED: bool = std::env::var("ALLOW_ADVANCED")
|
|
|
|
.unwrap_or("true".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
|
|
|
pub static ref ID_LENGTH: u32 = std::env::var("ID_LENGTH")
|
|
|
|
.unwrap_or("32".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
|
|
|
pub static ref ALLOW_FILES: bool = std::env::var("ALLOW_FILES")
|
|
|
|
.unwrap_or("true".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
2024-03-19 12:06:46 +00:00
|
|
|
pub static ref THEME_NEW_NOTE_NOTICE: bool = std::env::var("THEME_NEW_NOTE_NOTICE")
|
2024-03-15 14:26:33 +00:00
|
|
|
.unwrap_or("true".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
2022-03-01 14:24:17 +00:00
|
|
|
}
|
2022-07-16 12:16:54 +00:00
|
|
|
|
|
|
|
// THEME
|
|
|
|
lazy_static! {
|
|
|
|
pub static ref THEME_IMAGE: String = std::env::var("THEME_IMAGE")
|
|
|
|
.unwrap_or("".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
|
|
|
pub static ref THEME_TEXT: String = std::env::var("THEME_TEXT")
|
|
|
|
.unwrap_or("".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
2022-10-27 15:26:56 +00:00
|
|
|
pub static ref THEME_PAGE_TITLE: String = std::env::var("THEME_PAGE_TITLE")
|
|
|
|
.unwrap_or("".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
|
|
|
pub static ref THEME_FAVICON: String = std::env::var("THEME_FAVICON")
|
|
|
|
.unwrap_or("".to_string())
|
|
|
|
.parse()
|
|
|
|
.unwrap();
|
2022-07-16 12:16:54 +00:00
|
|
|
}
|