I need a debugger
This commit is contained in:
parent
ed927fe636
commit
75816058cf
2 changed files with 31 additions and 5 deletions
|
@ -49,13 +49,17 @@ impl Command {
|
|||
let gitlab_url = "https://gitlab.com";
|
||||
let jira_url = "https://jira.com";
|
||||
|
||||
let config_builder = Config::default_builder()?
|
||||
let config_builder = Config::builder(&tasks.config_file_path)?
|
||||
.set_override("gitlab.url", gitlab_url)?
|
||||
.set_override("jira.url", jira_url)?
|
||||
.set_override("secrets.gitlab_token", gitlab_url)?
|
||||
.set_override("secrets.jira_token", jira_url)?;
|
||||
|
||||
let config_result = config_builder.build()?.try_deserialize();
|
||||
dbg!(&config_builder);
|
||||
let built = config_builder.build()?;
|
||||
dbg!(&built);
|
||||
|
||||
let config_result = built.try_deserialize();
|
||||
dbg!(&config_result);
|
||||
if let Err(err) = &config_result {
|
||||
match err {
|
||||
|
|
|
@ -66,8 +66,12 @@ where {
|
|||
Ok(CConfig::builder()
|
||||
.set_default("version", CURRENT_VERSION)?
|
||||
.set_default("secrets", HashMap::<String, Value>::new())?
|
||||
.set_default("secrets.gitlab_token", "")?
|
||||
.set_default("secrets.jira_token", "")?
|
||||
.set_default("jira", HashMap::<String, Value>::new())?
|
||||
.set_default("gitlab", HashMap::<String, Value>::new())?)
|
||||
.set_default("gitlab", HashMap::<String, Value>::new())?
|
||||
.set_default("jira.url", "")?
|
||||
.set_default("gitlab.url", "")?)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
@ -82,8 +86,26 @@ mod tests {
|
|||
use crate::config::*;
|
||||
|
||||
#[test]
|
||||
fn defaults_deserialize_to_valid_config() -> Result<()> {
|
||||
println!("Defaults: {:?}", Config::defaults()?);
|
||||
fn default_config_toml_deserialize_to_valid_config() -> Result<()> {
|
||||
let tmp = std::env::temp_dir()
|
||||
.join("taskr_defaults.default_config_toml_deserialize_to_valid_config.toml");
|
||||
|
||||
std::fs::write(
|
||||
&tmp,
|
||||
r#"[gitlab]
|
||||
url = "https://gitlab.com"
|
||||
|
||||
[jira]
|
||||
url = "https://jira.com"
|
||||
|
||||
[secrets]
|
||||
gitlab_token = "asdf"
|
||||
jira_token = "1337"
|
||||
"#,
|
||||
)?;
|
||||
|
||||
println!("Defaults: {:?}", Config::load(&tmp)?);
|
||||
let _ = std::fs::remove_file(tmp);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue