From 8655c93853506acf05f6ae4e58bfc2c6198be254 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Mon, 12 Jun 2023 09:04:35 +0100 Subject: refactor server to allow pluggable db and tracing (#1036) * refactor server to allow pluggable db and tracing * clean up * fix descriptions * remove dependencies --- atuin-server/src/settings.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'atuin-server/src/settings.rs') diff --git a/atuin-server/src/settings.rs b/atuin-server/src/settings.rs index 981d239f..fb5325d4 100644 --- a/atuin-server/src/settings.rs +++ b/atuin-server/src/settings.rs @@ -3,24 +3,24 @@ use std::{io::prelude::*, path::PathBuf}; use config::{Config, Environment, File as ConfigFile, FileFormat}; use eyre::{eyre, Result}; use fs_err::{create_dir_all, File}; -use serde::{Deserialize, Serialize}; - -pub const HISTORY_PAGE_SIZE: i64 = 100; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct Settings { +pub struct Settings { pub host: String, pub port: u16, pub path: String, - pub db_uri: String, pub open_registration: bool, pub max_history_length: usize, pub page_size: i64, pub register_webhook_url: Option, pub register_webhook_username: String, + + #[serde(flatten)] + pub db_settings: DbSettings, } -impl Settings { +impl Settings { pub fn new() -> Result { let mut config_file = if let Ok(p) = std::env::var("ATUIN_CONFIG_DIR") { PathBuf::from(p) -- cgit v1.3.1