Propagate UniSender privacy flags to deployments
Some checks are pending
Quality / full-local-gates (push) Waiting to run

This commit is contained in:
SimpleTest 2026-07-21 16:00:41 +03:00
parent d1d64afe2b
commit e08916ef09
6 changed files with 45 additions and 1 deletions

View File

@ -28,6 +28,7 @@ x-app-environment: &app-environment
SMTP_SSL: ${SMTP_SSL:-false}
UNISENDER_GO_API_KEY: ${UNISENDER_GO_API_KEY:-}
UNISENDER_GO_BASE_URL: ${UNISENDER_GO_BASE_URL:-https://goapi.unisender.ru/ru/transactional/api/v1}
UNISENDER_GO_SKIP_UNSUBSCRIBE: ${UNISENDER_GO_SKIP_UNSUBSCRIBE:-false}
EMAIL_HTTP_CONNECT_TIMEOUT_MS: ${EMAIL_HTTP_CONNECT_TIMEOUT_MS:-}
EMAIL_HTTP_RECEIVE_TIMEOUT_MS: ${EMAIL_HTTP_RECEIVE_TIMEOUT_MS:-}
EMAIL_FROM_NAME: ${EMAIL_FROM_NAME:?Set EMAIL_FROM_NAME in .env}

View File

@ -55,6 +55,8 @@ spec:
value: {{ $root.Values.app.emailDeliveryProvider | quote }}
- name: UNISENDER_GO_BASE_URL
value: {{ $root.Values.app.unisenderGoBaseUrl | quote }}
- name: UNISENDER_GO_SKIP_UNSUBSCRIBE
value: {{ $root.Values.app.unisenderGoSkipUnsubscribe | quote }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
@ -101,6 +103,8 @@ spec:
value: {{ $root.Values.app.smtpPort | quote }}
- name: UNISENDER_GO_BASE_URL
value: {{ $root.Values.app.unisenderGoBaseUrl | quote }}
- name: UNISENDER_GO_SKIP_UNSUBSCRIBE
value: {{ $root.Values.app.unisenderGoSkipUnsubscribe | quote }}
- name: CODEX_SESSION_ID
value: {{ $root.Values.app.codexSessionId | quote }}
- name: RATE_LIMIT_POLICIES_JSON

View File

@ -47,6 +47,8 @@ spec:
value: {{ .Values.app.emailDeliveryProvider | quote }}
- name: UNISENDER_GO_BASE_URL
value: {{ .Values.app.unisenderGoBaseUrl | quote }}
- name: UNISENDER_GO_SKIP_UNSUBSCRIBE
value: {{ .Values.app.unisenderGoSkipUnsubscribe | quote }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true

View File

@ -20,12 +20,16 @@
"unisenderGoBaseUrl": {
"type": "string",
"pattern": "^https://"
},
"unisenderGoSkipUnsubscribe": {
"type": "boolean"
}
},
"required": [
"erlangPortLimit",
"emailDeliveryProvider",
"unisenderGoBaseUrl"
"unisenderGoBaseUrl",
"unisenderGoSkipUnsubscribe"
]
}
}

View File

@ -37,6 +37,7 @@ app:
smtpRelay: mailpit
smtpPort: "1025"
unisenderGoBaseUrl: https://goapi.unisender.ru/ru/transactional/api/v1
unisenderGoSkipUnsubscribe: false
# Required. The Secret must contain DATABASE_URL, SECRET_KEY_BASE,
# HANDOVER_SECRET, RELEASE_COOKIE, and METRICS_TOKEN. It may also contain both

View File

@ -136,6 +136,16 @@ PRODUCTION_CODEX_SESSION_ID=00000000-0000-0000-0000-000000000001 \
./scripts/init-production-env.sh help.test "$api_production_env" >/dev/null
./scripts/validate-production-env.sh "$api_production_env" help.test >/dev/null
grep -Fx 'EMAIL_DELIVERY_PROVIDER=unisender_go' "$api_production_env" >/dev/null
grep -Fx 'UNISENDER_GO_SKIP_UNSUBSCRIBE=false' "$api_production_env" >/dev/null
api_override_env="$scan_dir/.env.production.unisender-go-skip-unsubscribe"
PRODUCTION_EMAIL_DELIVERY_PROVIDER=unisender_go \
PRODUCTION_UNISENDER_GO_API_KEY=quality-unisender-go-api-key \
PRODUCTION_UNISENDER_GO_SKIP_UNSUBSCRIBE=true \
PRODUCTION_EMAIL_FROM_ADDRESS=contact@help.test \
PRODUCTION_CODEX_SESSION_ID=00000000-0000-0000-0000-000000000001 \
./scripts/init-production-env.sh help.test "$api_override_env" >/dev/null
./scripts/validate-production-env.sh "$api_override_env" help.test >/dev/null
grep -Fx 'UNISENDER_GO_SKIP_UNSUBSCRIBE=true' "$api_override_env" >/dev/null
if PRODUCTION_EMAIL_DELIVERY_PROVIDER=unisender_go \
PRODUCTION_CODEX_SESSION_ID=00000000-0000-0000-0000-000000000001 \
./scripts/init-production-env.sh \
@ -280,6 +290,11 @@ docker compose --project-directory "$ROOT" --env-file "$edge_env" \
./scripts/compose.sh .env.example config --quiet
./scripts/compose.sh "$production_env" config --quiet
./scripts/compose.sh "$api_production_env" config --quiet
./scripts/compose.sh "$api_override_env" config --format json |
jq --exit-status '
.services.app.environment.UNISENDER_GO_SKIP_UNSUBSCRIBE == "true" and
.services.migrate.environment.UNISENDER_GO_SKIP_UNSUBSCRIBE == "true"
' >/dev/null
./scripts/compose.sh "$external_production_env" config --quiet
./scripts/compose.sh "$external_socket_production_env" config --quiet
./scripts/compose.sh "$external_split_production_env" config --quiet
@ -503,12 +518,29 @@ tar --extract --file="$scan_tar" --directory "$scan_dir"
--values "$ROOT/deploy/helm/who-need-help/values-kind.yaml" \
"$ROOT/deploy/helm/who-need-help" \
>"$scan_dir/rendered-helm.yaml"
"$ROOT/.tools/bin/helm" template who-need-help \
--values "$ROOT/deploy/helm/who-need-help/values-kind.yaml" \
--set app.unisenderGoSkipUnsubscribe=true \
"$ROOT/deploy/helm/who-need-help" \
>"$scan_dir/rendered-helm-unisender-override.yaml"
test "$(
grep -c 'name: ERL_ZFLAGS' "$scan_dir/rendered-helm.yaml"
)" -eq 5
test "$(
grep -c 'value: "+Q 65536"' "$scan_dir/rendered-helm.yaml"
)" -eq 5
test "$(
grep -c 'name: UNISENDER_GO_SKIP_UNSUBSCRIBE' "$scan_dir/rendered-helm.yaml"
)" -eq 5
test "$(
grep -c 'name: UNISENDER_GO_SKIP_UNSUBSCRIBE' \
"$scan_dir/rendered-helm-unisender-override.yaml"
)" -eq 5
test "$(
grep -A1 'name: UNISENDER_GO_SKIP_UNSUBSCRIBE' \
"$scan_dir/rendered-helm-unisender-override.yaml" |
grep -c 'value: "true"'
)" -eq 5
test "$(
grep -c '^kind: NetworkPolicy$' "$scan_dir/rendered-helm.yaml"
)" -eq 1