1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Serialize, Deserialize, Debug)]
5pub struct DatabaseConfig {
6 pub name: String,
7 #[cfg(feature = "postgres")]
8 pub url: String,
9 #[cfg(feature = "postgres")]
10 pub user: String,
11 #[cfg(feature = "postgres")]
12 pub password: String,
13}
14
15impl Default for DatabaseConfig {
16 fn default() -> Self {
17 Self {
18 name: "atto.db".to_string(),
19 #[cfg(feature = "postgres")]
20 url: "localhost:5432".to_string(),
21 #[cfg(feature = "postgres")]
22 user: "postgres".to_string(),
23 #[cfg(feature = "postgres")]
24 password: "postgres".to_string(),
25 }
26 }
27}
28
29pub trait Configuration {
30 fn db_config(&self) -> DatabaseConfig;
31}