mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-31 16:57:02 +00:00
Exit if there's an error reading users/aliases files on startup
Today, when starting up, if there's an error reading the users or aliases files, we only log but do not exit. And then those files will not be attempted to be read on the periodic reload. We also treat "file does not exist" as an error for users file, but not aliases file, resulting in inconsistent behaviour between the two. All of this makes some classes of problems (like permission errors) more difficult to spot and troubleshoot. For example, https://github.com/albertito/chasquid/issues/55. So this patch makes errors reading users/aliases files on startup a fatal error, and also unifies the "file does not exist" behaviour to make it not an error in both cases. Note that the behaviour on the periodic reload is unchanged: treat these errors as fatal too. This may be changed in future patches.
This commit is contained in:
@@ -345,7 +345,8 @@ func (v *Resolver) AddDomain(domain string) {
|
||||
}
|
||||
|
||||
// AddAliasesFile to the resolver. The file will be parsed, and an error
|
||||
// returned if it does not exist or parse correctly.
|
||||
// returned if it does not parse correctly. Note that the file not existing
|
||||
// does NOT result in an error.
|
||||
func (v *Resolver) AddAliasesFile(domain, path string) error {
|
||||
// We unconditionally add the domain and file on our list.
|
||||
// Even if the file does not exist now, it may later. This makes it be
|
||||
|
||||
Reference in New Issue
Block a user