Skip to content

Commit

Permalink
mailpit: reject configurations w/o basic auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma27 committed Aug 14, 2024
1 parent 1d18501 commit 0a92dcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/batou_ext/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ class Mailpit(batou.component.Component):

max = batou.component.Attribute(int, 500)

http_auth_enable = batou.component.Attribute("literal", default=False)
http_basic_auth = None

provide_as = None # (optional) str to self.provide()
Expand All @@ -196,11 +195,10 @@ def configure(self):
self.public_smtp_name, self.smtp_port
)

if self.http_auth_enable:
if self.http_basic_auth is None:
self.http_auth = self.require_one("http_basic_auth")
else:
self.http_auth = self.http_basic_auth
if self.http_basic_auth is None:
self.http_auth = self.require_one("http_basic_auth")
else:
self.http_auth = self.http_basic_auth

self += batou.lib.file.File(
"/etc/local/nixos/mailpit.nix",
Expand Down
2 changes: 0 additions & 2 deletions src/batou_ext/resources/mailpit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
flyingcircus.services.nginx.virtualHosts."{{ component.public_name }}" = {
forceSSL = true;
enableACME = true;
# {% if component.http_auth_enable %}
basicAuthFile = "{{component.http_auth.path}}";
# {% endif %}
locations."/" = {
proxyPass = "http://[::1]:8025";
proxyWebsockets = true;
Expand Down

0 comments on commit 0a92dcd

Please sign in to comment.