From a14d67105edea53431068676d29b07e4599bde69 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sun, 31 Jan 2021 13:40:02 +0300 Subject: [PATCH] feat(cli): add database config --- migra-cli/src/config.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/migra-cli/src/config.rs b/migra-cli/src/config.rs index 6bd5619..ab71ac9 100644 --- a/migra-cli/src/config.rs +++ b/migra-cli/src/config.rs @@ -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)