fix: get rid of useless configuraiton options

This commit is contained in:
Aravinth Manivannan 2022-03-29 17:35:44 +05:30
parent a5c8ee722d
commit 8b075a66fd
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
2 changed files with 1 additions and 15 deletions

View File

@ -1,4 +1,3 @@
debug = true
source_code = "https://github.com/realaravinth/pages"
pages = [
@ -12,7 +11,4 @@ port = 7000
#IP address. Enter 0.0.0.0 to listen on all availale addresses
ip= "0.0.0.0"
# enter your hostname, eg: example.com
domain = "localhost"
allow_registration = true
proxy_has_tls = false
#workers = 2

View File

@ -27,9 +27,7 @@ use crate::page::Page;
#[derive(Debug, Clone, Deserialize)]
pub struct Server {
pub port: u32,
pub domain: String,
pub ip: String,
pub proxy_has_tls: bool,
pub workers: Option<usize>,
}
@ -42,8 +40,6 @@ impl Server {
#[derive(Debug, Clone, Deserialize)]
pub struct Settings {
pub debug: bool,
// pub database: Database,
pub server: Server,
pub source_code: String,
pub pages: Vec<Page>,
@ -53,16 +49,10 @@ pub struct Settings {
impl Settings {
pub fn new() -> Result<Self, ConfigError> {
let mut s = Config::new();
// setting default values
#[cfg(test)]
s.set_default("database.pool", 2.to_string())
.expect("Couldn't get the number of CPUs");
const CURRENT_DIR: &str = "./config/default.toml";
const ETC: &str = "/etc/static-pages/config.toml";
if let Ok(path) = env::var("ATHENA_CONFIG") {
if let Ok(path) = env::var("PAGES__CONFIG") {
s.merge(File::with_name(&path))?;
} else if Path::new(CURRENT_DIR).exists() {
// merging default config from file