mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-14 11:34:08 +00:00
Check that config is valid before saving (#2152)
This commit is contained in:
parent
b406342a14
commit
83e996111e
|
@ -88,6 +88,9 @@ impl Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn save_config_file(data: &str) -> Result<String, LemmyError> {
|
pub fn save_config_file(data: &str) -> Result<String, LemmyError> {
|
||||||
|
// check that the config is valid
|
||||||
|
from_str::<Settings>(data)?;
|
||||||
|
|
||||||
fs::write(Settings::get_config_location(), data)?;
|
fs::write(Settings::get_config_location(), data)?;
|
||||||
|
|
||||||
// Reload the new settings
|
// Reload the new settings
|
||||||
|
|
Loading…
Reference in a new issue