Use &str instead of String in save_config_value
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
2540a77af1
commit
600f9c58bf
|
@ -152,12 +152,12 @@ pub fn save_peach_config_to_disc(
|
|||
}
|
||||
|
||||
// helper functions for serializing and deserializing PeachConfig values from disc
|
||||
pub fn save_config_value(key: &str, value: String) -> Result<HashMap<String, String>, PeachError> {
|
||||
pub fn save_config_value(key: &str, value: &str) -> Result<HashMap<String, String>, PeachError> {
|
||||
// get current config from disc
|
||||
let mut peach_config = load_peach_config_from_disc()?;
|
||||
|
||||
// insert new key/value
|
||||
peach_config.insert(key.to_string(), value);
|
||||
peach_config.insert(key.to_string(), value.to_string());
|
||||
|
||||
// save hte modified hashmap to disc
|
||||
save_peach_config_to_disc(peach_config)
|
||||
|
@ -191,7 +191,7 @@ pub fn set_peach_dyndns_config(
|
|||
pub fn set_external_domain(
|
||||
new_external_domain: &str,
|
||||
) -> Result<HashMap<String, String>, PeachError> {
|
||||
save_config_value("EXTERNAL_DOMAIN", new_external_domain.to_string())
|
||||
save_config_value("EXTERNAL_DOMAIN", new_external_domain)
|
||||
}
|
||||
|
||||
pub fn get_peachcloud_domain() -> Result<Option<String>, PeachError> {
|
||||
|
@ -214,8 +214,8 @@ pub fn set_dyndns_enabled_value(
|
|||
enabled_value: bool,
|
||||
) -> Result<HashMap<String, String>, PeachError> {
|
||||
match enabled_value {
|
||||
true => save_config_value("DYN_ENABLED", "true".to_string()),
|
||||
false => save_config_value("DYN_ENABLED", "false".to_string()),
|
||||
true => save_config_value("DYN_ENABLED", "true"),
|
||||
false => save_config_value("DYN_ENABLED", "false"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ pub fn get_dyndns_enabled_value() -> Result<bool, PeachError> {
|
|||
pub fn set_admin_password_hash(
|
||||
password_hash: String,
|
||||
) -> Result<HashMap<String, String>, PeachError> {
|
||||
save_config_value("ADMIN_PASSWORD_HASH", password_hash)
|
||||
save_config_value("ADMIN_PASSWORD_HASH", &password_hash)
|
||||
}
|
||||
|
||||
pub fn get_admin_password_hash() -> Result<String, PeachError> {
|
||||
|
@ -242,7 +242,7 @@ pub fn get_admin_password_hash() -> Result<String, PeachError> {
|
|||
pub fn set_temporary_password_hash(
|
||||
password_hash: String,
|
||||
) -> Result<HashMap<String, String>, PeachError> {
|
||||
save_config_value("TEMPORARY_PASSWORD_HASH", password_hash)
|
||||
save_config_value("TEMPORARY_PASSWORD_HASH", &password_hash)
|
||||
}
|
||||
|
||||
pub fn get_temporary_password_hash() -> Result<String, PeachError> {
|
||||
|
@ -287,6 +287,6 @@ pub fn get_ssb_admin_ids() -> Result<Vec<String>, PeachError> {
|
|||
// takes in a Vec<String> and saves SSB_ADMIN_IDS as a json string representation of this vec
|
||||
pub fn save_ssb_admin_ids(ssb_admin_ids: Vec<String>) -> Result<Vec<String>, PeachError> {
|
||||
let ssb_admin_ids_as_json_str = serde_json::to_string(&ssb_admin_ids)?;
|
||||
save_config_value("SSB_ADMIN_IDS", ssb_admin_ids_as_json_str)?;
|
||||
save_config_value("SSB_ADMIN_IDS", &ssb_admin_ids_as_json_str)?;
|
||||
Ok(ssb_admin_ids)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue