Skip to content

Commit 33c6de5

Browse files
authored
Update Ghost docs to include info about run secrets (#2694)
no issue - add docs about _File environment variables + support for run secrets
1 parent 4aecb8f commit 33c6de5

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

ghost/content.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@ $ docker run -d --name some-ghost -e NODE_ENV=development -e url=http://some-gho
7070

7171
(There are further configuration examples in the `compose.yaml` listed below.)
7272

73+
## Docker Secrets
74+
75+
As an alternative to passing sensitive configuration values via environment variables, `_FILE` may be appended to a Ghost configuration environment variable, causing Ghost to read that value from a file in the container instead. In particular, this can be used to load secrets from Docker secrets stored in `/run/secrets/<secret_name>` files. For example:
76+
77+
```console
78+
$ docker run -d \
79+
--name some-ghost \
80+
-e database__client=mysql \
81+
-e database__connection__host=some-mysql \
82+
-e database__connection__user=ghost \
83+
-e database__connection__password_FILE=/run/secrets/ghost-db-password \
84+
-e database__connection__database=ghost \
85+
%%IMAGE%%
86+
```
87+
88+
This is supported for any nested configuration key (that is, any key containing at least one `__` separator), such as `database__connection__password` or `mail__options__auth__pass`. Top-level keys such as `url` are deliberately excluded, so that unrelated variables like `SSL_CERT_FILE` are not mistaken for Ghost configuration.
89+
90+
A single trailing newline is stripped from the file's contents (matching `$(cat file)` behavior); any other surrounding whitespace is preserved, in case it is part of the secret. Setting both `foo__bar` and `foo__bar_FILE`, or pointing two variables which resolve to the same configuration key at different files, is an error and Ghost will refuse to start.
91+
92+
Note: this requires Ghost 6.58.0 or newer.
93+
7394
## What is the Node.js version?
7495

7596
When opening a ticket at https://github.com/TryGhost/Ghost/issues it becomes necessary to know the version of Node.js in use:

0 commit comments

Comments
 (0)