feat(cli): add database config
This commit is contained in:
parent
d8ed9fd25a
commit
a14d67105e
1 changed files with 11 additions and 1 deletions
|
@ -6,17 +6,27 @@ const MIGRA_TOML_FILENAME: &str = "Migra.toml";
|
|||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub(crate) struct Config {
|
||||
directory: String,
|
||||
pub directory: String,
|
||||
pub database: DatabaseConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub(crate) struct DatabaseConfig {
|
||||
pub connection: String
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Config {
|
||||
Config {
|
||||
directory: String::from("database"),
|
||||
database: DatabaseConfig {
|
||||
connection: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl Config {
|
||||
pub fn read() -> Config {
|
||||
fs::read_to_string(MIGRA_TOML_FILENAME)
|
||||
|
|
Reference in a new issue