allow infra cli to add email aliases

This commit is contained in:
viktorbarzin 2021-04-08 22:12:45 +01:00
parent fccdb0cca4
commit bb536b969c
2 changed files with 3 additions and 3 deletions

View file

@ -43,7 +43,7 @@ func addEmailAlias(gitFs *GitFS, to, fromDomain string) (string, error) {
newContents := getAddedAliasContents(string(fileContentsBytes), aliasEmail, to) newContents := getAddedAliasContents(string(fileContentsBytes), aliasEmail, to)
// Write new contents // Write new contents
fWrite, err := (*gitFs.fs).OpenFile(emailAliasesConfigFileRelative, os.O_WRONLY, 0644) fWrite, err := (*gitFs.fs).OpenFile(emailAliasesConfigFileRelative, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil { if err != nil {
return "", errors.Wrapf(err, "failed to open file where new email alias will be added") return "", errors.Wrapf(err, "failed to open file where new email alias will be added")
} }
@ -77,5 +77,5 @@ func getAddedAliasContents(currentContents, from, to string) string {
} }
} }
newLines = append(newLines, getPostFixAlias(from, to)) newLines = append(newLines, getPostFixAlias(from, to))
return strings.Join(newLines, "\n") return strings.Join(newLines, "\n") + "\n"
} }

View file

@ -1 +1 @@
increasingly-gudrun-generated@viktorbarzin.me me@viktorbarzin.me # Add aliases here. Example: 'test@viktorbarzin.me me@viktorbarzin.me' will point test@ -> me@