diff --git a/ffddns-web/src/config.rs b/ffddns-web/src/config.rs
new file mode 100644
index 0000000000000000000000000000000000000000..7f30eec847ea51135a7f9a477a9f18ebae910966
--- /dev/null
+++ b/ffddns-web/src/config.rs
@@ -0,0 +1,24 @@
+use serde::{Serialize, Deserialize};
+use serde;
+
+
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct Config {
+	pub domain: Vec<Domain>,
+	pub master: String,
+	pub rname: String,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct Domain {
+	/// the domain suffix. eg. for a dynamic domain
+	/// mydomain.ddns.org the name here is ddns.org
+	pub name: String,
+	/// a short description for a domain
+	pub description: String,
+	/// a list of networks, which a subdomain from this
+	/// domain is allowed to updated to
+	pub nets: Vec<String>,
+	/// duration in days before a subdomain gets 'released' wgen not updated
+	pub registration_time: usize,
+}
diff --git a/ffddns-web/src/main.rs b/ffddns-web/src/main.rs
index 443538646c8a76372ffa8edd1324a6ea4e4a51f5..afac3f5a0c5bb385d7a59c9d8feeabfcff3a836d 100644
--- a/ffddns-web/src/main.rs
+++ b/ffddns-web/src/main.rs
@@ -2,6 +2,7 @@
 
 mod db;
 mod web;
+mod config;
 
 use chrono::DateTime;
 use chrono::Utc;
@@ -18,17 +19,78 @@ use rocket::request::Outcome;
 use std::fmt::{self, Display};
 use std::net::IpAddr;
 use rand;
+use toml;
+use lazy_static::lazy_static;
+use config::Config;
+use std::fs;
+use std::path;
+use std::io::Read;
+use log::{debug, info, error};
+use std::process::exit;
+
+
+const CONFIG_DIRS: &[&str] = &[
+	"./ffdyndns.toml",
+	"/etc/ffdyndns.toml",
+	"/var/lib/ffdyndns/ffdyndns.toml",
+];
+
+lazy_static! {
+	pub static ref CONFIG: Config = {
+		let file = CONFIG_DIRS.iter()
+			.map(|x| path::Path::new(x))
+			.find(|p| p.exists() && p.is_file());
+
+		match file {
+			Some(f) => {
+				debug!("loading config: {}", f.to_str().unwrap());
+				let mut f = fs::File::open(f).unwrap();
+				let mut toml_str = String::new();
+				f.read_to_string(&mut toml_str).expect("can't read config file");
+
+				match toml::from_str::<Config>(&toml_str) {
+					Err(e) => {
+						eprintln!("configuration error: {}", e);
+						exit(1);
+					}
+					Ok(r) => r
+				}
+			}
+			None => {
+				eprintln!("could not find config file");
+				exit(1);
+			},
+		}
+	};
+}
+
+
+// for p in CONFIG_DIRS.iter().map(|x| path::Path::new(x)) {
+// 	if !p.exists() || !p.is_file() {
+// 		continue;
+// 	}
+// 	debug!("loading config: {}", p.to_str().unwrap());
+// 	let mut f = fs::File::open(p).unwrap();
+// 	let mut toml_str = String::new();
+// 	f.read_to_string(&mut toml_str).expect("can't read config file");
+
+// 	config = toml::from_str::<Config>(&toml_str).unwrap()
+// };
+
+// return config;
 
 
 
 #[derive(Debug, Clone)]
 pub struct DomainUpdate {
-    domain: String,
-    ip: IpAddr
+	domain: String,
+	ip: IpAddr
 }
 
 
 fn main() {
-    let db = db::Database::new("./ffddns.sqlite".into());
-    web::start_web(db);
+	println!("{:?}", CONFIG.domain);
+
+	let db = db::Database::new("./ffddns.sqlite".into());
+	web::start_web(db);
 }