config/datastore.rs - open file for reading
This commit is contained in:
parent
926fc18687
commit
6349ed60b4
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue