diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-04-09 12:40:21 +0100 |
|---|---|---|
| committer | Ellie Huxtable <e@elm.sh> | 2021-04-09 12:40:21 +0100 |
| commit | 9f16f76bd8d15824e27e971245ea93271fe76b29 (patch) | |
| tree | 6687ec0f743edb682dbb9f04f688fd059f404174 /src/settings.rs | |
| parent | Bump rusqlite from 0.24.2 to 0.25.0 (#30) (diff) | |
| download | atuin-9f16f76bd8d15824e27e971245ea93271fe76b29.zip | |
Update config
Diffstat (limited to 'src/settings.rs')
| -rw-r--r-- | src/settings.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/settings.rs b/src/settings.rs index 6f29afd2..0e554bed 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -6,25 +6,20 @@ use eyre::{eyre, Result}; use std::fs; #[derive(Debug, Deserialize)] -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, pub dialect: String, - pub db: LocalDatabase, + pub sync: bool, + pub sync_address: String, + pub sync_frequency: String, + pub db_path: String, } #[derive(Debug, Deserialize)] pub struct Remote { - pub db: RemoteDatabase, + pub host: String, + pub port: u16, + pub db_uri: String, + pub open_registration: bool, } #[derive(Debug, Deserialize)] @@ -56,18 +51,23 @@ impl Settings { .data_dir() .join("history.db"); - s.set_default("local.server_address", "https://atuin.elliehuxtable.com")?; + s.set_default("local.db_path", db_path.to_str())?; s.set_default("local.dialect", "us")?; - s.set_default("local.db.path", db_path.to_str())?; + s.set_default("local.sync", false)?; + s.set_default("local.sync_frequency", "5m")?; + s.set_default("local.sync_address", "https://atuin.ellie.wtf")?; - s.set_default("remote.db.url", "please set a postgres url")?; + s.set_default("remote.host", "127.0.0.1")?; + s.set_default("remote.port", 8888)?; + s.set_default("remote.open_registration", false)?; + s.set_default("remote.db_uri", "please set a postgres url")?; if config_file.exists() { s.merge(File::with_name(config_file.to_str().unwrap()))?; } // all paths should be expanded - let db_path = s.get_str("local.db.path")?; + let db_path = s.get_str("local.db_path")?; let db_path = shellexpand::full(db_path.as_str())?; s.set("local.db.path", db_path.to_string())?; |
