Running with RUNTIME_SECRET
unset in the shell.
$ caddy run
$ http localhost:8080
HTTP/1.1 200 OK
Content-Length: 178
Content-Type: text/html; charset=utf-8
Date: Wed, 13 Jul 2022 11:01:11 GMT
Server: Caddy
<!DOCTYPE html>
<html>
<head>
<title>Caddy Template</title>
</head>
<body>
<h1>Hello World.</h1>
<p>
The current secret is
</p>
</body>
</html>
Running with RUNTIME_SECRET
set to a value in the shell before running Caddy
$ RUNTIME_SECRET=zomgwtfbbqsekrit caddy run
$ http localhost:8080
HTTP/1.1 200 OK
Content-Length: 194
Content-Type: text/html; charset=utf-8
Date: Wed, 13 Jul 2022 11:02:26 GMT
Server: Caddy
<!DOCTYPE html>
<html>
<head>
<title>Caddy Template</title>
</head>
<body>
<h1>Hello World.</h1>
<p>
The current secret is zomgwtfbbqsekrit
</p>
</body>
</html>
Build the docker image first, reuse it for both examples
$ docker build -t caddy-template:dev .
Without anything set for RUNTIME_SECRET
$ docker run -it --rm -p 8080:8080 caddy-template:dev
$ http localhost:8080
HTTP/1.1 200 OK
Content-Length: 178
Content-Type: text/html; charset=utf-8
Date: Wed, 13 Jul 2022 11:07:04 GMT
Server: Caddy
<!DOCTYPE html>
<html>
<head>
<title>Caddy Template</title>
</head>
<body>
<h1>Hello World.</h1>
<p>
The current secret is
</p>
</body>
</html>
Setting the secret value to something in the docker container env
$ docker build -t caddy-template:dev .
$ docker run -it --rm -p 8080:8080 -e RUNTIME_SECRET=zomgwtfbbqsekrit caddy-template:dev
$ http localhost:8080
HTTP/1.1 200 OK
Content-Length: 194
Content-Type: text/html; charset=utf-8
Date: Wed, 13 Jul 2022 11:08:55 GMT
Server: Caddy
<!DOCTYPE html>
<html>
<head>
<title>Caddy Template</title>
</head>
<body>
<h1>Hello World.</h1>
<p>
The current secret is zomgwtfbbqsekrit
</p>
</body>
</html>