Skip to content

Commit

Permalink
allow specifying multiple hostnames
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
lilyinstarlight committed Jul 5, 2022
1 parent 06f1a24 commit 4222aaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions carillon
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,8 @@ def caddy_generate():
continue

line = line.replace('%BIND%', config['http']['bind'])
line = line.replace('%OPTIONAL_HTTP_PORT%', ':' + config['http']['http_port'] if config['http']['http_port'] != '80' else '')
line = line.replace('%OPTIONAL_HTTPS_PORT%', ':' + config['http']['https_port'] if config['http']['https_port'] != '443' else '')
line = line.replace('%HOST%', config['http']['host'])
line = line.replace('%HTTP_ADDRESS%', ', '.join('http://' + host + ':' + (config['http']['http_port'] if config['http']['http_port'] != '80' else '') for host in config['http']['host'].split(' ')))
line = line.replace('%HTTPS_ADDRESS%', ', '.join('https://' + host + ':' + (config['http']['https_port'] if config['http']['https_port'] != '443' else '') for host in config['http']['host'].split(' ')))
line = line.replace('%TLS%', config['http']['tls'])

line = line.replace('%ALLOW_UPDATE%', config['http']['allow_update'])
Expand Down
6 changes: 3 additions & 3 deletions conf/Caddyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
protocol http
}

redir @http https://%HOST%:8443{uri} permanent
redir @http https://{hostport}{uri} permanent
%%TLS_END%%
%%UPDATE_BEGIN%%

Expand All @@ -44,14 +44,14 @@
%%UPDATE_END%%
}

http://%HOST%%OPTIONAL_HTTP_PORT% {
%HTTP_ADDRESS% {
bind %BIND%

import radio
}
%%TLS_BEGIN%%

https://%HOST%%OPTIONAL_HTTPS_PORT% {
%HTTPS_ADDRESS% {
bind %BIND%

tls %TLS%
Expand Down

0 comments on commit 4222aaf

Please sign in to comment.