fix: get rid of useless configuraiton options
This commit is contained in:
parent
a5c8ee722d
commit
8b075a66fd
|
@ -1,4 +1,3 @@
|
||||||
debug = true
|
|
||||||
source_code = "https://github.com/realaravinth/pages"
|
source_code = "https://github.com/realaravinth/pages"
|
||||||
|
|
||||||
pages = [
|
pages = [
|
||||||
|
@ -12,7 +11,4 @@ port = 7000
|
||||||
#IP address. Enter 0.0.0.0 to listen on all availale addresses
|
#IP address. Enter 0.0.0.0 to listen on all availale addresses
|
||||||
ip= "0.0.0.0"
|
ip= "0.0.0.0"
|
||||||
# enter your hostname, eg: example.com
|
# enter your hostname, eg: example.com
|
||||||
domain = "localhost"
|
|
||||||
allow_registration = true
|
|
||||||
proxy_has_tls = false
|
|
||||||
#workers = 2
|
#workers = 2
|
||||||
|
|
|
@ -27,9 +27,7 @@ use crate::page::Page;
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
pub port: u32,
|
pub port: u32,
|
||||||
pub domain: String,
|
|
||||||
pub ip: String,
|
pub ip: String,
|
||||||
pub proxy_has_tls: bool,
|
|
||||||
pub workers: Option<usize>,
|
pub workers: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +40,6 @@ impl Server {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
pub debug: bool,
|
|
||||||
// pub database: Database,
|
|
||||||
pub server: Server,
|
pub server: Server,
|
||||||
pub source_code: String,
|
pub source_code: String,
|
||||||
pub pages: Vec<Page>,
|
pub pages: Vec<Page>,
|
||||||
|
@ -53,16 +49,10 @@ pub struct Settings {
|
||||||
impl Settings {
|
impl Settings {
|
||||||
pub fn new() -> Result<Self, ConfigError> {
|
pub fn new() -> Result<Self, ConfigError> {
|
||||||
let mut s = Config::new();
|
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 CURRENT_DIR: &str = "./config/default.toml";
|
||||||
const ETC: &str = "/etc/static-pages/config.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))?;
|
s.merge(File::with_name(&path))?;
|
||||||
} else if Path::new(CURRENT_DIR).exists() {
|
} else if Path::new(CURRENT_DIR).exists() {
|
||||||
// merging default config from file
|
// merging default config from file
|
||||||
|
|
Loading…
Reference in New Issue