-
Notifications
You must be signed in to change notification settings - Fork 1
fix: prevent duplicate newsletter sends from dev/test containers (#440) #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ ENV_ARGS="" | |
| [ -n "$PGUSER" ] && ENV_ARGS="$ENV_ARGS -e PGUSER=$PGUSER" | ||
| [ -n "$PGPASSWORD" ] && ENV_ARGS="$ENV_ARGS -e PGPASSWORD=$PGPASSWORD" | ||
| [ -n "$PGDATABASE" ] && ENV_ARGS="$ENV_ARGS -e PGDATABASE=$PGDATABASE" | ||
| [ -n "$NEWSLETTER_SEND_ENABLED" ] && ENV_ARGS="$ENV_ARGS -e NEWSLETTER_SEND_ENABLED=$NEWSLETTER_SEND_ENABLED" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ENV_ARGS variable is built here but is never actually used or passed to any podman run command in this script (the container instead relies on the mounted /etc/rotv/environment file). Adding NEWSLETTER_SEND_ENABLED to ENV_ARGS here is dead code and has no effect. Additionally, to ensure that the test container also has newsletter sends disabled by default, NEWSLETTER_SEND_ENABLED=false (or NEWSLETTER_SEND_ENABLED=${NEWSLETTER_SEND_ENABLED:-false}) should be added to the ~/.rotv/environment-test file generation block around line 244-255. Otherwise, since isSendEnabled() in buttondownClient.js defaults to true when the environment variable is undefined, the test container will run with newsletter sends enabled. |
||
|
|
||
| case "${1:-help}" in | ||
| build-base) | ||
|
|
@@ -165,6 +166,7 @@ MCP_ADMIN_TOKEN=$MCP_ADMIN_TOKEN | |
| PGUSER=${PGUSER:-postgres} | ||
| PGPASSWORD=${PGPASSWORD:-rotv} | ||
| PGDATABASE=${PGDATABASE:-rotv} | ||
| NEWSLETTER_SEND_ENABLED=${NEWSLETTER_SEND_ENABLED:-false} | ||
| ENVFILE | ||
| fi | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable check is currently case-sensitive. If a user or environment configuration sets NEWSLETTER_SEND_ENABLED=FALSE or False, the check !== 'false' will evaluate to true, and newsletter sends will remain enabled. To prevent accidental sends due to casing differences, we should perform a case-insensitive check.