From 970aadb62082b36f39957a67d4707e2aafb98869 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Tue, 24 Nov 2020 15:46:27 -0500 Subject: [PATCH] docs: Add Caddyfile env var default value (#112) --- src/docs/markdown/caddyfile/concepts.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/docs/markdown/caddyfile/concepts.md b/src/docs/markdown/caddyfile/concepts.md index 3bd6ef22..ef125f25 100644 --- a/src/docs/markdown/caddyfile/concepts.md +++ b/src/docs/markdown/caddyfile/concepts.md @@ -298,6 +298,12 @@ If your configuration relies on environment variables, you can use them in the C Environment variables in this form are substituted before parsing begins, so they can expand to empty values, partial tokens, complete tokens, or even multiple tokens and lines. +A default value can be specified for when the environment variable is not found, by using `:` as the delimiter between the variable name and the default value: + +```caddy +{$DOMAIN:localhost} +``` + If you want to defer the substitution of an environment variable until runtime, you can use the [standard `{env.*}` placeholders](/docs/conventions#placeholders).