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)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub(crate) struct Config {
|
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 {
|
impl Default for Config {
|
||||||
fn default() -> Config {
|
fn default() -> Config {
|
||||||
Config {
|
Config {
|
||||||
directory: String::from("database"),
|
directory: String::from("database"),
|
||||||
|
database: DatabaseConfig {
|
||||||
|
connection: String::new(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn read() -> Config {
|
pub fn read() -> Config {
|
||||||
fs::read_to_string(MIGRA_TOML_FILENAME)
|
fs::read_to_string(MIGRA_TOML_FILENAME)
|
||||||
|
|
Reference in a new issue