From 8a94368dec22ccac09ea36d0b17b49c7c99ca661 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Fri, 10 Feb 2023 14:20:22 -0800 Subject: [PATCH] #82 Minor polish to the command --- homelab/server/config/ddns/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homelab/server/config/ddns/README.md b/homelab/server/config/ddns/README.md index 65475c3f..523d9e22 100644 --- a/homelab/server/config/ddns/README.md +++ b/homelab/server/config/ddns/README.md @@ -9,9 +9,10 @@ So we generate the config file when it must be updated. To update the file, we c cd ~/homelab/server/config/ddns/ && \ export $(cat ddclient_secrets.env | xargs) && \ envsubst < ./ddclient/ddclient.template > ./ddclient/ddclient.conf && \ -unset $(grep -v '^#' ddclient_secrets.env | sed -E 's/(.*)=.*/\1/' | xargs) +unset $(grep -v '^#' ddclient_secrets.env | sed -E 's/(.*)=.*/\1/' | xargs) && \ +docker-compose up -d --force-recreate ``` -First we export the variables in the `ddclient_secrets.env` file (which are all simple key-value pairs). Then, the [`envsubst`](https://www.baeldung.com/linux/envsubst-command) command looks for env variable references (like `$USER_Jafner_chat`) in the `ddclient.template` file (via stdin) and replaces them with the values from the current shell. Lastly, we remove the secrets from the shell to preserve security. +First we export the variables in the `ddclient_secrets.env` file (which are all simple key-value pairs). Then, the [`envsubst`](https://www.baeldung.com/linux/envsubst-command) command looks for env variable references (like `$USER_Jafner_chat`) in the `ddclient.template` file (via stdin) and replaces them with the values from the current shell. We remove the secrets from the shell to preserve security. Finally, we recreate the container to apply the new settings. [StackOverflow - Set environment variables from file of ke/value pairs](https://stackoverflow.com/questions/19331497/set-environment-variables-from-file-of-key-value-pairs) \ No newline at end of file