Skip to content

Commit

Permalink
Caddyfile.generate: Support redirect-only domains
Browse files Browse the repository at this point in the history
For example:
> [libexpat.github.io]
> aliases =
>         libexpat.org
>     www.libexpat.org
  • Loading branch information
hartwork committed Jan 6, 2025
1 parent d9962a6 commit d7904d2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Caddyfile.generate
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class CaddyfileGenerator:
)

for domain, backend_authority in sorted(self._backend_of.items()):
if backend_authority is None:
continue

print(
dedent("""
%s {
Expand Down Expand Up @@ -80,7 +83,11 @@ def run(options):
alias_domains = config.get(domain, "aliases").split()
except NoOptionError:
alias_domains = []
backend_authority = config.get(domain, "backend")

try:
backend_authority = config.get(domain, "backend")
except NoOptionError:
backend_authority = None

site = CaddyfileGenerator.Site(alias_domains, backend_authority, domain)
caddyfile.add(site)
Expand Down

0 comments on commit d7904d2

Please sign in to comment.