Skip to content

Commit d7904d2

Browse files
committed
Caddyfile.generate: Support redirect-only domains
For example: > [libexpat.github.io] > aliases = > libexpat.org > www.libexpat.org
1 parent d9962a6 commit d7904d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Caddyfile.generate

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ class CaddyfileGenerator:
4545
)
4646

4747
for domain, backend_authority in sorted(self._backend_of.items()):
48+
if backend_authority is None:
49+
continue
50+
4851
print(
4952
dedent("""
5053
%s {
@@ -80,7 +83,11 @@ def run(options):
8083
alias_domains = config.get(domain, "aliases").split()
8184
except NoOptionError:
8285
alias_domains = []
83-
backend_authority = config.get(domain, "backend")
86+
87+
try:
88+
backend_authority = config.get(domain, "backend")
89+
except NoOptionError:
90+
backend_authority = None
8491

8592
site = CaddyfileGenerator.Site(alias_domains, backend_authority, domain)
8693
caddyfile.add(site)

0 commit comments

Comments
 (0)