aboutsummaryrefslogtreecommitdiffstats
path: root/src/settings.rs
diff options
context:
space:
mode:
authorEllie Huxtable <e@elm.sh>2021-03-21 20:04:39 +0000
committerGitHub <noreply@github.com>2021-03-21 20:04:39 +0000
commitc9579cb9ca2a6a165d10f128e0af1dfd372e0c03 (patch)
tree1d4feecb422aae3cde1cc7cad54ccc73b2dae410 /src/settings.rs
parentAdd TUI, resolve #19, #17, #16 (#21) (diff)
downloadatuin-c9579cb9ca2a6a165d10f128e0af1dfd372e0c03.zip
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
Diffstat (limited to '')
-rw-r--r--src/settings.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/settings.rs b/src/settings.rs
index a4c9f8da..6f29afd2 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -11,6 +11,11 @@ pub struct LocalDatabase {
}
#[derive(Debug, Deserialize)]
+pub struct RemoteDatabase {
+ pub url: String,
+}
+
+#[derive(Debug, Deserialize)]
pub struct Local {
pub server_address: String,
pub dialect: String,
@@ -18,8 +23,14 @@ pub struct Local {
}
#[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()))?;
}