From c9579cb9ca2a6a165d10f128e0af1dfd372e0c03 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Sun, 21 Mar 2021 20:04:39 +0000 Subject: Implement server (#23) * Add initial database and server setup * Set up all routes, auth, etc * Implement sessions, password auth, hashing with argon2, and history storage --- src/settings.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index a4c9f8da..6f29afd2 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -10,6 +10,11 @@ pub struct LocalDatabase { pub path: String, } +#[derive(Debug, Deserialize)] +pub struct RemoteDatabase { + pub url: String, +} + #[derive(Debug, Deserialize)] pub struct Local { pub server_address: String, @@ -17,9 +22,15 @@ pub struct Local { pub db: LocalDatabase, } +#[derive(Debug, Deserialize)] +pub struct Remote { + pub db: RemoteDatabase, +} + #[derive(Debug, Deserialize)] pub struct Settings { pub local: Local, + pub remote: Remote, } impl Settings { @@ -49,6 +60,8 @@ impl Settings { s.set_default("local.dialect", "us")?; s.set_default("local.db.path", db_path.to_str())?; + s.set_default("remote.db.url", "please set a postgres url")?; + if config_file.exists() { s.merge(File::with_name(config_file.to_str().unwrap()))?; } -- cgit v1.3.1