config/datastore.rs - open file for reading

This commit is contained in:
Dietmar Maurer 2018-12-09 10:22:39 +01:00
parent 926fc18687
commit 6349ed60b4
1 changed files with 2 additions and 1 deletions

View File

@ -38,6 +38,7 @@ pub fn config() -> Result<SectionConfigData, Error> {
let mut file = match OpenOptions::new() let mut file = match OpenOptions::new()
.create(true) .create(true)
.read(true)
.write(true) .write(true)
.open(DATASTORE_CFG_FILENAME) { .open(DATASTORE_CFG_FILENAME) {
Ok(file) => file, Ok(file) => file,
@ -46,7 +47,7 @@ pub fn config() -> Result<SectionConfigData, Error> {
}; };
let mut contents = String::new(); let mut contents = String::new();
file.read_to_string(&mut contents).unwrap(); file.read_to_string(&mut contents)?;
CONFIG.parse(DATASTORE_CFG_FILENAME, &contents) CONFIG.parse(DATASTORE_CFG_FILENAME, &contents)
} }