Skip to content

Commit

Permalink
Another try with current CLI options only
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Jul 9, 2023
1 parent fb73f99 commit 6738a0e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
8 changes: 4 additions & 4 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,19 @@ Default value: `'http.git,http.filter,http.ipfilter'`

##### <a name="-caddy--caddy_http_port"></a>`caddy_http_port`

Data type: `Stdlib::Port`
Data type: `Optional[Stdlib::Port]`

Which port for HTTP is used.

Default value: `80`
Default value: `undef`

##### <a name="-caddy--caddy_https_port"></a>`caddy_https_port`

Data type: `Stdlib::Port`
Data type: `Optional[Stdlib::Port]`

Which port for HTTPS is used.

Default value: `443`
Default value: `undef`

##### <a name="-caddy--caddy_architecture"></a>`caddy_architecture`

Expand Down
11 changes: 9 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
Enum['personal', 'commercial'] $caddy_license = 'personal',
Enum['on','off'] $caddy_telemetry = 'off',
String[1] $caddy_features = 'http.git,http.filter,http.ipfilter',
Stdlib::Port $caddy_http_port = 80,
Stdlib::Port $caddy_https_port = 443,
Optional[Stdlib::Port] $caddy_http_port = undef,
Optional[Stdlib::Port] $caddy_https_port = undef,
String[1] $caddy_architecture = $facts['os']['architecture'],
Optional[String[1]] $caddy_account_id = undef,
Optional[String[1]] $caddy_api_key = undef,
Expand All @@ -109,6 +109,13 @@
Optional[String[1]] $systemd_ambient_capabilities = undef,
Optional[Boolean] $systemd_no_new_privileges = undef,
) {
if $caddy_http_port {
notice { '$caddy::caddy_http_port is noop and will be removed in a future version': }
}
if $caddy_https_port {
notice { '$caddy::caddy_https_port is noop and will be removed in a future version': }
}

case $caddy_architecture {
'x86_64', 'amd64': { $arch = 'amd64' }
'x86' : { $arch = '386' }
Expand Down
2 changes: 0 additions & 2 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
caddy_log_dir => $caddy::caddy_log_dir,
caddy_ssl_dir => $caddy::caddy_ssl_dir,
caddy_home => $caddy::caddy_home,
caddy_http_port => $caddy::caddy_http_port,
caddy_https_port => $caddy::caddy_https_port,
systemd_limit_processes => $caddy::systemd_limit_processes,
systemd_private_devices => $caddy::systemd_private_devices,
systemd_capability_bounding_set => $caddy::systemd_capability_bounding_set,
Expand Down
3 changes: 2 additions & 1 deletion templates/etc/systemd/system/caddy.service.epp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ Environment=HOME=<%= $caddy_home %>
Environment=CADDYPATH=<%= $caddy_ssl_dir %>

; Always set "-root" to something safe in case it gets forgotten in the Caddyfile.
ExecStart=<%= $install_path %>/caddy --log=<%= $caddy_log_dir %>/caddy.log --agree=true --conf=/etc/caddy/Caddyfile --root=/var/tmp --http-port=<%= $caddy_http_port %> --https-port=<%= $caddy_https_port %>
ExecStart=<%= $install_path %>/caddy run --config=/etc/caddy/Caddyfile
ExecReload=/bin/kill -USR1 $MAINPID
StandardOutput=append:<%= $caddy_log_dir %>/caddy.log

; Use graceful shutdown with a reasonable timeout
KillMode=mixed
Expand Down

0 comments on commit 6738a0e

Please sign in to comment.