fix (config): save config when disk is full

before this, if the user had a full disk, there wouldn't be any error
reported back whenever editing something in the admin
console as file.Close() would return nil ....

The only way to go around it is to wait for the sync to be done.
This commit is contained in:
MickaelK
2024-11-28 02:03:32 +11:00
parent 8303ae54f0
commit 5e420cf5f3

View File

@ -108,5 +108,9 @@ func SaveConfig(v []byte) error {
configStr = val
}
file.Write(PrettyPrint([]byte(configStr)))
if err = file.Sync(); err != nil {
file.Close()
return err
}
return file.Close()
}