feat: add client subscription startup policy

This commit is contained in:
QiuSW
2026-07-28 15:14:48 +08:00
parent f0f34156da
commit 1c100c5d7e
15 changed files with 290 additions and 21 deletions
+13
View File
@@ -14,6 +14,7 @@ import os
from decimal import Decimal
from pathlib import Path
from config.client_subscription_policy import build_client_subscription_policy
from django.core.exceptions import ImproperlyConfigured
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -80,6 +81,18 @@ if CMSHOPEE_SUBSCRIPTION_MODE not in {"open", "shadow", "enforce"}:
)
# Kept as an effective compatibility setting for integrations that still inspect it.
CMSHOPEE_SUBSCRIPTION_ENFORCEMENT = CMSHOPEE_SUBSCRIPTION_MODE == "enforce"
CMSHOPEE_CLIENT_SUBSCRIPTION_POLICY = os.environ.get(
"CMSHOPEE_CLIENT_SUBSCRIPTION_POLICY",
"off",
).strip().lower()
CMSHOPEE_CLIENT_SUBSCRIPTION_POLICY_UPDATED_AT = os.environ.get(
"CMSHOPEE_CLIENT_SUBSCRIPTION_POLICY_UPDATED_AT",
"",
).strip()
build_client_subscription_policy(
mode=CMSHOPEE_CLIENT_SUBSCRIPTION_POLICY,
updated_at=CMSHOPEE_CLIENT_SUBSCRIPTION_POLICY_UPDATED_AT,
)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env_bool("DJANGO_DEBUG", True)