From a268422e9d5409e2d98af1769b495836a1ea5983 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A8=8B=E8=B6=8A?=
 <44216455+cyicz123@users.noreply.github.com>
Date: Mon, 12 Aug 2024 11:12:21 +0800
Subject: [PATCH] fix(Doc): fix escaping issue for PASSWORD_HASH in
 docker-compose.yml

For users using docker-compose.yml, please note that you should not wrap the generated hash password in single quotes. Instead, replace each `$` symbol with two `$$` symbols.

For example, for the password 'foobar123', use the following command to generate the hash:
`docker run ghcr.io/wg-easy/wg-easy wgpw foobar123`

The resulting hash should be used in docker-compose.yml like this:
``` yaml
- PASSWORD_HASH=$$2y$$10$$hBCoykrB95WSzuV4fafBzOHWKu9sbyVa34GJr8VV5R/pIelfEMYyG
```

Signed-off-by: cyicz123 <cyicz123@outlook.com>
---
 How_to_generate_an_bcrypt_hash.md | 10 +++++++++-
 docker-compose.yml                |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/How_to_generate_an_bcrypt_hash.md b/How_to_generate_an_bcrypt_hash.md
index 1a6a63c6..e77e3717 100644
--- a/How_to_generate_an_bcrypt_hash.md
+++ b/How_to_generate_an_bcrypt_hash.md
@@ -16,7 +16,7 @@ docker run ghcr.io/wg-easy/wg-easy wgpw YOUR_PASSWORD
 PASSWORD_HASH='$2b$12$coPqCsPtcFO.Ab99xylBNOW4.Iu7OOA2/ZIboHN6/oyxca3MWo7fW' // literally YOUR_PASSWORD
 ```
 
-*Important* : make sure to enclose your password in **single quotes** when you run `docker run` command :
+**Important** : make sure to enclose your password in **single quotes** when you run `docker run` command :
 
 ```bash
 $ echo $2b$12$coPqCsPtcF <-- not correct
@@ -26,3 +26,11 @@ b2
 $ echo '$2b$12$coPqCsPtcF' <-- correct
 $2b$12$coPqCsPtcF
 ```
+
+**Important** : Please note: don't wrap the generated hash password in single quotes when you use `docker-compose.yml`. Instead, replace each `$` symbol with two `$$` symbols. For example:
+
+``` yaml
+- PASSWORD_HASH=$$2y$$10$$hBCoykrB95WSzuV4fafBzOHWKu9sbyVa34GJr8VV5R/pIelfEMYyG
+```
+
+This hash is for the password 'foobar123', obtained using the command `docker run ghcr.io/wg-easy/wg-easy wgpw foobar123` and then inserted an additional `$` before each existing `$` symbal.
diff --git a/docker-compose.yml b/docker-compose.yml
index f4c93c4a..dd450ed9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -12,7 +12,7 @@ services:
       - WG_HOST=raspberrypi.local
 
       # Optional:
-      # - PASSWORD_HASH='$2y$10$hBCoykrB95WSzuV4fafBzOHWKu9sbyVa34GJr8VV5R/pIelfEMYyG' (hash of 'foobar123'; see "How_to_generate_an_bcrypt_hash.md" for generate the hash)
+      # - PASSWORD_HASH=$$2y$$10$$hBCoykrB95WSzuV4fafBzOHWKu9sbyVa34GJr8VV5R/pIelfEMYyG (needs double $$, hash of 'foobar123'; see "How_to_generate_an_bcrypt_hash.md" for generate the hash)
       # - PORT=51821
       # - WG_PORT=51820
       # - WG_CONFIG_PORT=92820