use super::{config_from_object, AdapterError};
use crate::properties::properties_to_hocon;
use crate::Config;
pub fn parse(input: &str, origin: Option<&str>) -> Result<Config, AdapterError> {
let value = properties_to_hocon(super::strip_bom(input)).map_err(AdapterError::new)?;
Ok(config_from_object(value, origin))
}
pub fn parse_file(path: impl AsRef<std::path::Path>) -> Result<Config, AdapterError> {
let path = path.as_ref();
let text = std::fs::read_to_string(path)
.map_err(|e| AdapterError::new(format!("properties: {}: {e}", path.display())))?;
parse(&text, Some(&path.display().to_string()))
}