in src/app.rs [690:717]
fn save_using_target(cx: &mut Context, desc: TableDescription) -> Result<(), DyneinConfigError> {
let table_name: String = desc
.table_name
.clone()
.expect("desc should have table name");
let port: u32 = cx.effective_port();
// retrieve current config from Context and update "using target".
let region = Some(String::from(cx.effective_region().name()));
let mut config = cx.config.as_mut().expect("cx should have config");
config.using_region = region;
config.using_table = Some(table_name);
config.using_port = Some(port);
debug!("config file will be updated with: {:?}", config);
// write to config file
let config_yaml_string = serde_yaml::to_string(config)?;
fs::write(
retrieve_dynein_file_path(DyneinFileType::ConfigFile)?,
config_yaml_string,
)?;
// save target table info into cache.
insert_to_table_cache(cx, desc)?;
Ok(())
}