aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp/templates/templates.go
diff options
context:
space:
mode:
authorPatrick Hein <[email protected]>2020-07-21 01:17:38 +0200
committerGitHub <[email protected]>2020-07-20 17:17:38 -0600
commit2bc30bb780f3b93593a2a9e42db6ab215fe12902 (patch)
tree5047581931bd12b53b3f460e222a806b12ca185f /modules/caddyhttp/templates/templates.go
parent28d870c193f33920cd10e3038151d18173e533ec (diff)
downloadcaddy-2bc30bb780f3b93593a2a9e42db6ab215fe12902.tar.gz
caddy-2bc30bb780f3b93593a2a9e42db6ab215fe12902.zip
templates: Implement placeholders function (#3324)
* caddyhttp, httpcaddyfile: Implement placeholders in template * caddyhttp, httpcaddyfile: Remove support for placeholder shorthands in templates * Update modules/caddyhttp/templates/templates.go updates JSON doc Co-authored-by: Matt Holt <[email protected]> * Update modules/caddyhttp/templates/tplcontext.go Co-authored-by: Matt Holt <[email protected]> Co-authored-by: Matt Holt <[email protected]>
Diffstat (limited to 'modules/caddyhttp/templates/templates.go')
-rw-r--r--modules/caddyhttp/templates/templates.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/caddyhttp/templates/templates.go b/modules/caddyhttp/templates/templates.go
index f5df9be0a..f9ce1c39a 100644
--- a/modules/caddyhttp/templates/templates.go
+++ b/modules/caddyhttp/templates/templates.go
@@ -64,6 +64,16 @@ func init() {
// {{env "VAR_NAME"}}
// ```
//
+// ##### `placeholder`
+//
+// Gets an [placeholder variable](/docs/conventions#placeholders).
+// The braces (`{}`) have to be omitted.
+//
+// ```
+// {{placeholder "http.request.uri.path"}}
+// {{placeholder "http.error.status_code"}}
+// ```
+//
// ##### `.Host`
//
// Returns the hostname portion (no port) of the Host header of the HTTP request.