-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement vhost_dir and vhost_enable_dir support
This change allows to use the config files layout similar to apache/nginx (conf.d or sites-{enabled,allowed}).
- Loading branch information
Showing
13 changed files
with
636 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# @summary This defined type handles the Caddy config file | ||
# | ||
# @param ensure | ||
# Make the config file either present or absent. | ||
# | ||
# @param source | ||
# Source (path) for the caddy config file. | ||
# | ||
# @param content | ||
# String with the caddy config file. | ||
# | ||
# @param config_dir | ||
# Where to store the config file. | ||
# | ||
# @example Configure Caddy logging | ||
# caddy::configfile { 'subdomain-log': | ||
# source => 'puppet:///modules/caddy/etc/caddy/config/logging.conf', | ||
# } | ||
# | ||
# @example Same as above but using content | ||
# $log_config = @(SUBDOMAIN_LOG) | ||
# (subdomain-log) { | ||
# log { | ||
# hostnames {args[0]} | ||
# output file /var/log/caddy/{args[0]}.log | ||
# } | ||
# } | ||
# | SUBDOMAIN_LOG | ||
# | ||
# caddy::configfile { 'subdomain-log': | ||
# content => $log_config, | ||
# } | ||
# | ||
define caddy::configfile ( | ||
Enum['present','absent'] $ensure = 'present', | ||
Optional[Stdlib::Filesource] $source = undef, | ||
Optional[String] $content = undef, | ||
Stdlib::Absolutepath $config_dir = $caddy::config_dir, | ||
) { | ||
include caddy | ||
|
||
if ($ensure == 'present') and !($source or $content) { | ||
fail('Either $source or $content must be specified when $ensure is "present"') | ||
} | ||
|
||
file { "${config_dir}/${title}.conf": | ||
ensure => stdlib::ensure($ensure, 'file'), | ||
content => $content, | ||
source => $source, | ||
mode => '0444', | ||
require => Class['caddy::config'], | ||
notify => Class['caddy::service'], | ||
} | ||
} |
Oops, something went wrong.