-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip email on maintenance, shorten toot, add intellij stuff do gitignore
- Loading branch information
Showing
3 changed files
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ npm-debug.log | |
*.dat | ||
/archived/ | ||
/data/ | ||
*.iml | ||
/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
defmodule Fd.DownEmail do | ||
require Logger | ||
import Swoosh.Email | ||
import Fd.Util, only: [idna: 1] | ||
|
||
def down_email(instance = %Fd.Instances.Instance{}, check) do | ||
new() | ||
|> to({idna(instance.domain), instance.email}) | ||
|> from({"fediverse.network monitoring", "[email protected]"}) | ||
|> reply_to("root+instance-mon-#{instance.id}@fediverse.network") | ||
|> put_bcc("root+instance-mon-#{instance.id}@fediverse.network") | ||
|> subject("#{idna(instance.domain)} is down") | ||
|> html_body(html(instance, check)) | ||
|> text_body(text(instance, check)) | ||
if instance.settings.maintenance_mode? do | ||
Logger.info("Skipping down email for #{instance.domain} because maintenance is planned") | ||
else | ||
new() | ||
|> to({idna(instance.domain), instance.email}) | ||
|> from({"fediverse.network monitoring", "[email protected]"}) | ||
|> reply_to("root+instance-mon-#{instance.id}@fediverse.network") | ||
|> put_bcc("root+instance-mon-#{instance.id}@fediverse.network") | ||
|> subject("#{idna(instance.domain)} is down") | ||
|> html_body(html(instance, check)) | ||
|> text_body(text(instance, check)) | ||
end | ||
end | ||
|
||
def login(_), do: :error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,7 +239,7 @@ defmodule Fd.Instances.Crawler do | |
"" | ||
end | ||
if crawler.state.instance.settings.maintenance_mode? do | ||
post("is undergoing planned maintenance#{error}", crawler.instance, "[email protected]") | ||
post("is undergoing maintenance#{error}", crawler.instance, "[email protected]") | ||
else | ||
post("is down#{error}", crawler.instance, "[email protected]") | ||
end | ||
|