1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-18 14:47:03 +00:00

domaininfo: Reload periodically

This patch makes chasquid reload domaininfo periodically, so it notices
any external changes made to it.

It is in line with what we do for aliases and authentication already,
and makes it possible for external removals an additions to the
domaininfo database to be picked up without a restart.
This commit is contained in:
Alberto Bertogli
2018-05-20 12:21:15 +01:00
parent 2064e9e65d
commit a177fec7c3
5 changed files with 83 additions and 25 deletions

View File

@@ -37,3 +37,17 @@ func RemoveIfOk(t *testing.T, dir string) {
os.RemoveAll(dir)
}
}
func Rewrite(t *testing.T, path, contents string) error {
// Safeguard, to make sure we only mess with test files.
if !strings.Contains(path, "testlib_") {
panic("invalid/dangerous path")
}
err := ioutil.WriteFile(path, []byte(contents), 0600)
if err != nil {
t.Errorf("failed to rewrite file: %v", err)
}
return err
}