-
-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1575 from jay7x/more-epp
Use EPP template in nginx::resource::map
- Loading branch information
Showing
5 changed files
with
59 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<%- | | ||
Optional[String] $default = undef, | ||
Boolean $hostnames, | ||
Array[String] $include_files, | ||
Nginx::StringMappings $mappings, | ||
String $name, | ||
String[2] $string, | ||
| -%> | ||
# MANAGED BY PUPPET | ||
map <%= $string %> $<%= $name %> { | ||
<% if $hostnames { -%> | ||
hostnames; | ||
<% } -%> | ||
<% if $default { -%> | ||
default <%= $default %>; | ||
<% } -%> | ||
<%- $include_files.each |$h| { -%> | ||
include <%= $h %>; | ||
<%- } -%> | ||
|
||
<%- | ||
$m = $mappings ? { | ||
Hash => $mappings.keys.sort.map |$k| { { key => $k, value => $mappings[$k] } }, | ||
default => $mappings, | ||
} | ||
$field_width = $m.map |$x| { $x['key'].length }.max | ||
-%> | ||
<%- $m.each |$h| { -%> | ||
<%= sprintf("%-*s %s", $field_width, $h['key'], $h['value']) %>; | ||
<%- } -%> | ||
} |
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
# @summary custom type for the `map` variable mapping | ||
# @see http://nginx.org/en/docs/http/ngx_http_map_module.html | ||
type Nginx::StringMappings = Variant[ | ||
Array[Struct[{ 'key' => String[1], 'value' => String }]], | ||
Hash[String[1], String] | ||
] |