make squid's allowed domains editable at runtime in the swarm ui
This commit is contained in:
parent
86e80250bb
commit
c9abc2a42b
1 changed files with 2307 additions and 35 deletions
|
|
@ -233,7 +233,7 @@ where
|
|||
}
|
||||
|
||||
/// The file's text, or the empty string when it does not exist.
|
||||
fn read_or_empty(file: &Path) -> Result<String> {
|
||||
pub(super) fn read_or_empty(file: &Path) -> Result<String> {
|
||||
match std::fs::read_to_string(file) {
|
||||
Ok(text) => Ok(text),
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(String::new()),
|
||||
|
|
@ -243,7 +243,7 @@ fn read_or_empty(file: &Path) -> Result<String> {
|
|||
|
||||
/// Write `text` to `file` unless it already holds exactly that. Returns
|
||||
/// whether it wrote.
|
||||
fn write_if_changed(file: &Path, text: &str) -> Result<bool> {
|
||||
pub(super) fn write_if_changed(file: &Path, text: &str) -> Result<bool> {
|
||||
if read_or_empty(file)? == text {
|
||||
return Ok(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue