add: move database drivers to oiseau
This commit is contained in:
parent
40fce4bc77
commit
81036e3733
57 changed files with 638 additions and 1106 deletions
|
@ -1,3 +1,4 @@
|
|||
use oiseau::config::{Configuration, DatabaseConfig};
|
||||
use pathbufd::PathBufD;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fs;
|
||||
|
@ -83,29 +84,9 @@ impl Default for DirsConfig {
|
|||
}
|
||||
}
|
||||
|
||||
/// Database configuration.
|
||||
#[derive(Clone, Serialize, Deserialize, Debug)]
|
||||
pub struct DatabaseConfig {
|
||||
pub name: String,
|
||||
#[cfg(feature = "postgres")]
|
||||
pub url: String,
|
||||
#[cfg(feature = "postgres")]
|
||||
pub user: String,
|
||||
#[cfg(feature = "postgres")]
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
impl Default for DatabaseConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
name: "atto.db".to_string(),
|
||||
#[cfg(feature = "postgres")]
|
||||
url: "localhost:5432".to_string(),
|
||||
#[cfg(feature = "postgres")]
|
||||
user: "postgres".to_string(),
|
||||
#[cfg(feature = "postgres")]
|
||||
password: "postgres".to_string(),
|
||||
}
|
||||
impl Configuration for Config {
|
||||
fn db_config(&self) -> DatabaseConfig {
|
||||
self.database.to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue