Skip to content

Commit 119eb1f

Browse files
Copilotsstidl
andauthored
Add GDPR_EMAIL environment variable for Docker deployments (#743)
* Initial plan * Add GDPR_EMAIL environment variable for Docker deployments Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> * Improve GDPR_EMAIL handling with proper escaping and loop Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> * Refine GDPR_EMAIL processing - skip index.html and improve escaping Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> * Optimize GDPR_EMAIL sed commands and improve escaping Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> * Clarify sed escaping comment for GDPR_EMAIL Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
1 parent 0570377 commit 119eb1f

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

doc_docker.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ services:
3838
#REDACT_IP_ADDRESSES: "false"
3939
#PASSWORD:
4040
#EMAIL:
41+
#GDPR_EMAIL: "privacy@example.com"
4142
#DISABLE_IPINFO: "false"
4243
#IPINFO_APIKEY: "your api key"
4344
#DISTANCE: "km"
@@ -72,6 +73,7 @@ Here's a list of additional environment variables available in this mode:
7273
* mssql - not supported in docker image yet (feel free to open a PR with that, has to be done in `entrypoint.sh`)
7374
* __`PASSWORD`__: Password to access the stats page. If not set, stats page will not allow accesses.
7475
* __`EMAIL`__: Email address for GDPR requests. Must be specified when telemetry is enabled.
76+
* __`GDPR_EMAIL`__: Email address displayed in the privacy policy for data deletion requests. If not set, the default placeholder text will be shown. This should be set to comply with GDPR requirements when running in production.
7577
* __`DISABLE_IPINFO`__: If set to `true`, ISP info and distance will not be fetched from either [ipinfo.io](https://ipinfo.io) or the offline database. Default: value: `false`
7678
* __`IPINFO_APIKEY`__: API key for [ipinfo.io](https://ipinfo.io). Optional, but required if you want to use the full [ipinfo.io](https://ipinfo.io) APIs (required for distance measurement)
7779
* __`DISTANCE`__: When `DISABLE_IPINFO` is set to false, this specifies how the distance from the server is measured. Can be either `km` for kilometers, `mi` for miles, or an empty string to disable distance measurement. Requires an [ipinfo.io](https://ipinfo.io) API key. Default value: `km`

docker/entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ echo "WEBPORT: $WEBPORT"
77
echo "REDACT_IP_ADDRESSES: $REDACT_IP_ADDRESSES"
88
echo "DB_TYPE: $DB_TYPE"
99
echo "ENABLE_ID_OBFUSCATION: $ENABLE_ID_OBFUSCATION"
10+
echo "GDPR_EMAIL: $GDPR_EMAIL"
1011

1112
set -e
1213
#set -x
@@ -73,6 +74,18 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
7374
# generate config for just the local server
7475
echo '[{"name":"local","server":"/backend", "dlURL": "garbage.php", "ulURL": "empty.php", "pingURL": "empty.php", "getIpURL": "getIP.php", "sponsorName": "", "sponsorURL": "", "id":1 }]' > /var/www/html/server-list.json
7576
fi
77+
78+
# Replace GDPR email placeholder if GDPR_EMAIL is set
79+
if [ ! -z "$GDPR_EMAIL" ]; then
80+
# Escape special sed characters: & (replacement), / (delimiter), \ (escape), $ (variable)
81+
GDPR_EMAIL_ESCAPED=$(printf '%s\n' "$GDPR_EMAIL" | sed 's/[&/\\]/\\&/g; s/\$/\\$/g')
82+
83+
for html_file in /var/www/html/index-modern.html /var/www/html/index-classic.html; do
84+
if [ -f "$html_file" ]; then
85+
sed -i "s/TO BE FILLED BY DEVELOPER/$GDPR_EMAIL_ESCAPED/g; s/PUT@YOUR_EMAIL.HERE/$GDPR_EMAIL_ESCAPED/g" "$html_file"
86+
fi
87+
done
88+
fi
7689
fi
7790
# Configure design preference via config.json
7891
if [ "$USE_NEW_DESIGN" == "true" ]; then

0 commit comments

Comments
 (0)