Archived
1
0
Fork 0

feat(cli): add database config

This commit is contained in:
Dmitriy Pleshevskiy 2021-01-31 13:40:02 +03:00
parent d8ed9fd25a
commit a14d67105e

View file

@ -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)