Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/execution-report-heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ jobs:
CLOUD_RUN_SERVICES: ${{ vars.CLOUD_RUN_SERVICES }}
CLOUD_RUN_SERVICE_TARGETS_JSON: ${{ vars.CLOUD_RUN_SERVICE_TARGETS_JSON }}
GLOBAL_TELEGRAM_CHAT_ID: ${{ vars.GLOBAL_TELEGRAM_CHAT_ID }}
CRISIS_ALERT_TELEGRAM_CHAT_IDS: ${{ vars.CRISIS_ALERT_TELEGRAM_CHAT_IDS }}
CRISIS_ALERT_TELEGRAM_API_BASE_URL: ${{ vars.CRISIS_ALERT_TELEGRAM_API_BASE_URL }}
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CRISIS_ALERT_TELEGRAM_BOT_TOKEN: ${{ secrets.CRISIS_ALERT_TELEGRAM_BOT_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/runtime-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ jobs:
CLOUD_RUN_SERVICES: ${{ vars.CLOUD_RUN_SERVICES }}
CLOUD_RUN_SERVICE_TARGETS_JSON: ${{ vars.CLOUD_RUN_SERVICE_TARGETS_JSON }}
GLOBAL_TELEGRAM_CHAT_ID: ${{ vars.GLOBAL_TELEGRAM_CHAT_ID }}
CRISIS_ALERT_TELEGRAM_CHAT_IDS: ${{ vars.CRISIS_ALERT_TELEGRAM_CHAT_IDS }}
CRISIS_ALERT_TELEGRAM_API_BASE_URL: ${{ vars.CRISIS_ALERT_TELEGRAM_API_BASE_URL }}
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CRISIS_ALERT_TELEGRAM_BOT_TOKEN: ${{ secrets.CRISIS_ALERT_TELEGRAM_BOT_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
Expand Down
335 changes: 185 additions & 150 deletions .github/workflows/sync-cloud-run-env.yml

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,6 @@ def _runtime_error_notification_targets() -> tuple[tuple[str, str], ...]:
targets: list[tuple[str, str]] = []
if TG_TOKEN and TG_CHAT_ID:
targets.append((TG_TOKEN, TG_CHAT_ID))
crisis_token = os.getenv("CRISIS_ALERT_TELEGRAM_BOT_TOKEN")
for chat_id in _split_env_list(os.getenv("CRISIS_ALERT_TELEGRAM_CHAT_IDS")):
if crisis_token and chat_id:
targets.append((crisis_token, chat_id))

seen: set[tuple[str, str]] = set()
unique_targets: list[tuple[str, str]] = []
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flask
gunicorn
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.7.37
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@3b6a0a9bedde72773e188041e0dc48516b38aadc
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@v0.7.52
hk-equity-strategies @ git+https://github.com/QuantStrategyLab/HkEquityStrategies.git@v0.4.3
pandas
Expand Down
178 changes: 89 additions & 89 deletions runtime_config_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,36 +152,36 @@ class PlatformRuntimeSettings:
quantconnect_version_id: str | None = None
quantconnect_credentials_secret_name: str | None = None
quantconnect_brokerage_secret_name: str | None = None
crisis_alert_channels: tuple[str, ...] = ()
crisis_alert_email_recipients: tuple[str, ...] = ()
crisis_alert_email_sender_email: str | None = None
crisis_alert_email_sender_password: str | None = None
crisis_alert_email_smtp_host: str | None = None
crisis_alert_email_smtp_port: str | None = None
crisis_alert_email_smtp_security: str | None = None
crisis_alert_sms_recipients: tuple[str, ...] = ()
crisis_alert_sms_provider: str | None = None
crisis_alert_sms_account_id: str | None = None
crisis_alert_sms_auth_token: str | None = None
crisis_alert_sms_sender: str | None = None
crisis_alert_sms_messaging_service_id: str | None = None
crisis_alert_sms_api_base_url: str | None = None
crisis_alert_sms_body_max_chars: str | None = None
crisis_alert_push_recipients: tuple[str, ...] = ()
crisis_alert_push_provider: str | None = None
crisis_alert_push_app_token: str | None = None
crisis_alert_push_access_token: str | None = None
crisis_alert_push_api_base_url: str | None = None
crisis_alert_push_device: str | None = None
crisis_alert_push_priority: str | None = None
crisis_alert_push_tags: str | None = None
crisis_alert_push_body_max_chars: str | None = None
crisis_alert_telegram_chat_ids: tuple[str, ...] = ()
crisis_alert_telegram_bot_token: str | None = None
crisis_alert_telegram_api_base_url: str | None = None
crisis_alert_telegram_parse_mode: str | None = None
crisis_alert_telegram_disable_web_page_preview: str | None = None
crisis_alert_telegram_body_max_chars: str | None = None
strategy_plugin_alert_channels: tuple[str, ...] = ()
strategy_plugin_alert_email_recipients: tuple[str, ...] = ()
strategy_plugin_alert_email_sender_email: str | None = None
strategy_plugin_alert_email_sender_password: str | None = None
strategy_plugin_alert_email_smtp_host: str | None = None
strategy_plugin_alert_email_smtp_port: str | None = None
strategy_plugin_alert_email_smtp_security: str | None = None
strategy_plugin_alert_sms_recipients: tuple[str, ...] = ()
strategy_plugin_alert_sms_provider: str | None = None
strategy_plugin_alert_sms_account_id: str | None = None
strategy_plugin_alert_sms_auth_token: str | None = None
strategy_plugin_alert_sms_sender: str | None = None
strategy_plugin_alert_sms_messaging_service_id: str | None = None
strategy_plugin_alert_sms_api_base_url: str | None = None
strategy_plugin_alert_sms_body_max_chars: str | None = None
strategy_plugin_alert_push_recipients: tuple[str, ...] = ()
strategy_plugin_alert_push_provider: str | None = None
strategy_plugin_alert_push_app_token: str | None = None
strategy_plugin_alert_push_access_token: str | None = None
strategy_plugin_alert_push_api_base_url: str | None = None
strategy_plugin_alert_push_device: str | None = None
strategy_plugin_alert_push_priority: str | None = None
strategy_plugin_alert_push_tags: str | None = None
strategy_plugin_alert_push_body_max_chars: str | None = None
strategy_plugin_alert_telegram_chat_ids: tuple[str, ...] = ()
strategy_plugin_alert_telegram_bot_token: str | None = None
strategy_plugin_alert_telegram_api_base_url: str | None = None
strategy_plugin_alert_telegram_parse_mode: str | None = None
strategy_plugin_alert_telegram_disable_web_page_preview: str | None = None
strategy_plugin_alert_telegram_body_max_chars: str | None = None
runtime_target: RuntimeTarget | None = None
execution_backend: str = EXECUTION_BACKEND_GATEWAY

Expand Down Expand Up @@ -353,93 +353,93 @@ def load_platform_runtime_settings(
quantconnect_version_id=group_config.quantconnect_version_id,
quantconnect_credentials_secret_name=group_config.quantconnect_credentials_secret_name,
quantconnect_brokerage_secret_name=group_config.quantconnect_brokerage_secret_name,
crisis_alert_channels=split_env_list(os.getenv("CRISIS_ALERT_CHANNELS")),
crisis_alert_email_recipients=split_env_list(
os.getenv("CRISIS_ALERT_EMAIL_RECIPIENTS")
strategy_plugin_alert_channels=split_env_list(os.getenv("STRATEGY_PLUGIN_ALERT_CHANNELS")),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve legacy alert settings during the rename

When a deployed service, or the Cloud Run env-sync workflow before repository vars/secrets are manually renamed, still has the previous CRISIS_ALERT_* settings, this loader now ignores them and returns empty strategy-plugin alert configuration because it only reads STRATEGY_PLUGIN_ALERT_*. Since the workflow also removes the old Cloud Run names, existing alert channels/tokens/chat IDs are silently dropped on the first deploy; keeping a fallback to the old env names during the migration would prevent strategy-plugin alert delivery from being disabled.

Useful? React with 👍 / 👎.

strategy_plugin_alert_email_recipients=split_env_list(
os.getenv("STRATEGY_PLUGIN_ALERT_EMAIL_RECIPIENTS")
),
crisis_alert_email_sender_email=first_non_empty(
os.getenv("CRISIS_ALERT_EMAIL_SENDER_EMAIL")
strategy_plugin_alert_email_sender_email=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_EMAIL_SENDER_EMAIL")
),
crisis_alert_email_sender_password=first_non_empty(
os.getenv("CRISIS_ALERT_EMAIL_SENDER_PASSWORD")
strategy_plugin_alert_email_sender_password=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_EMAIL_SENDER_PASSWORD")
),
crisis_alert_email_smtp_host=first_non_empty(
os.getenv("CRISIS_ALERT_EMAIL_SMTP_HOST")
strategy_plugin_alert_email_smtp_host=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_EMAIL_SMTP_HOST")
),
crisis_alert_email_smtp_port=first_non_empty(
os.getenv("CRISIS_ALERT_EMAIL_SMTP_PORT")
strategy_plugin_alert_email_smtp_port=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_EMAIL_SMTP_PORT")
),
crisis_alert_email_smtp_security=first_non_empty(
os.getenv("CRISIS_ALERT_EMAIL_SMTP_SECURITY")
strategy_plugin_alert_email_smtp_security=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_EMAIL_SMTP_SECURITY")
),
crisis_alert_sms_recipients=split_env_list(
os.getenv("CRISIS_ALERT_SMS_RECIPIENTS")
strategy_plugin_alert_sms_recipients=split_env_list(
os.getenv("STRATEGY_PLUGIN_ALERT_SMS_RECIPIENTS")
),
crisis_alert_sms_provider=first_non_empty(
os.getenv("CRISIS_ALERT_SMS_PROVIDER")
strategy_plugin_alert_sms_provider=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_SMS_PROVIDER")
),
crisis_alert_sms_account_id=first_non_empty(
os.getenv("CRISIS_ALERT_SMS_ACCOUNT_ID")
strategy_plugin_alert_sms_account_id=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_SMS_ACCOUNT_ID")
),
crisis_alert_sms_auth_token=first_non_empty(
os.getenv("CRISIS_ALERT_SMS_AUTH_TOKEN")
strategy_plugin_alert_sms_auth_token=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_SMS_AUTH_TOKEN")
),
crisis_alert_sms_sender=first_non_empty(
os.getenv("CRISIS_ALERT_SMS_SENDER")
strategy_plugin_alert_sms_sender=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_SMS_SENDER")
),
crisis_alert_sms_messaging_service_id=first_non_empty(
os.getenv("CRISIS_ALERT_SMS_MESSAGING_SERVICE_ID")
strategy_plugin_alert_sms_messaging_service_id=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_SMS_MESSAGING_SERVICE_ID")
),
crisis_alert_sms_api_base_url=first_non_empty(
os.getenv("CRISIS_ALERT_SMS_API_BASE_URL")
strategy_plugin_alert_sms_api_base_url=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_SMS_API_BASE_URL")
),
crisis_alert_sms_body_max_chars=first_non_empty(
os.getenv("CRISIS_ALERT_SMS_BODY_MAX_CHARS")
strategy_plugin_alert_sms_body_max_chars=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_SMS_BODY_MAX_CHARS")
),
crisis_alert_push_recipients=split_env_list(
os.getenv("CRISIS_ALERT_PUSH_RECIPIENTS")
strategy_plugin_alert_push_recipients=split_env_list(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_RECIPIENTS")
),
crisis_alert_push_provider=first_non_empty(
os.getenv("CRISIS_ALERT_PUSH_PROVIDER")
strategy_plugin_alert_push_provider=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_PROVIDER")
),
crisis_alert_push_app_token=first_non_empty(
os.getenv("CRISIS_ALERT_PUSH_APP_TOKEN")
strategy_plugin_alert_push_app_token=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_APP_TOKEN")
),
crisis_alert_push_access_token=first_non_empty(
os.getenv("CRISIS_ALERT_PUSH_ACCESS_TOKEN")
strategy_plugin_alert_push_access_token=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_ACCESS_TOKEN")
),
crisis_alert_push_api_base_url=first_non_empty(
os.getenv("CRISIS_ALERT_PUSH_API_BASE_URL")
strategy_plugin_alert_push_api_base_url=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_API_BASE_URL")
),
crisis_alert_push_device=first_non_empty(
os.getenv("CRISIS_ALERT_PUSH_DEVICE")
strategy_plugin_alert_push_device=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_DEVICE")
),
crisis_alert_push_priority=first_non_empty(
os.getenv("CRISIS_ALERT_PUSH_PRIORITY")
strategy_plugin_alert_push_priority=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_PRIORITY")
),
crisis_alert_push_tags=first_non_empty(
os.getenv("CRISIS_ALERT_PUSH_TAGS")
strategy_plugin_alert_push_tags=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_TAGS")
),
crisis_alert_push_body_max_chars=first_non_empty(
os.getenv("CRISIS_ALERT_PUSH_BODY_MAX_CHARS")
strategy_plugin_alert_push_body_max_chars=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_PUSH_BODY_MAX_CHARS")
),
crisis_alert_telegram_chat_ids=split_env_list(
os.getenv("CRISIS_ALERT_TELEGRAM_CHAT_IDS")
strategy_plugin_alert_telegram_chat_ids=split_env_list(
os.getenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_CHAT_IDS")
),
crisis_alert_telegram_bot_token=first_non_empty(
os.getenv("CRISIS_ALERT_TELEGRAM_BOT_TOKEN")
strategy_plugin_alert_telegram_bot_token=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_BOT_TOKEN")
),
crisis_alert_telegram_api_base_url=first_non_empty(
os.getenv("CRISIS_ALERT_TELEGRAM_API_BASE_URL")
strategy_plugin_alert_telegram_api_base_url=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_API_BASE_URL")
),
crisis_alert_telegram_parse_mode=first_non_empty(
os.getenv("CRISIS_ALERT_TELEGRAM_PARSE_MODE")
strategy_plugin_alert_telegram_parse_mode=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_PARSE_MODE")
),
crisis_alert_telegram_disable_web_page_preview=first_non_empty(
os.getenv("CRISIS_ALERT_TELEGRAM_DISABLE_WEB_PAGE_PREVIEW")
strategy_plugin_alert_telegram_disable_web_page_preview=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_DISABLE_WEB_PAGE_PREVIEW")
),
crisis_alert_telegram_body_max_chars=first_non_empty(
os.getenv("CRISIS_ALERT_TELEGRAM_BODY_MAX_CHARS")
strategy_plugin_alert_telegram_body_max_chars=first_non_empty(
os.getenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_BODY_MAX_CHARS")
),
runtime_target=runtime_target,
)
Expand Down
6 changes: 1 addition & 5 deletions scripts/cloud_run_runtime_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ def _summarize(entry: dict[str, Any]) -> str:

def _send_telegram(message: str) -> bool:
targets: list[tuple[str, str]] = []
crisis_token = os.environ.get("CRISIS_ALERT_TELEGRAM_BOT_TOKEN")
for chat_id in _split_values(os.environ.get("CRISIS_ALERT_TELEGRAM_CHAT_IDS")):
if crisis_token:
targets.append((crisis_token, chat_id))

token = os.environ.get("TELEGRAM_TOKEN") or os.environ.get("TG_TOKEN")
for chat_id in _split_values(os.environ.get("GLOBAL_TELEGRAM_CHAT_ID")):
Expand All @@ -184,7 +180,7 @@ def _send_telegram(message: str) -> bool:
return False

ok = True
base_url = os.environ.get("CRISIS_ALERT_TELEGRAM_API_BASE_URL") or "https://api.telegram.org"
base_url = "https://api.telegram.org"
for token_value, chat_id in unique_targets:
body = urllib.parse.urlencode({"chat_id": chat_id, "text": message}).encode()
request = urllib.request.Request(
Expand Down
6 changes: 1 addition & 5 deletions scripts/execution_report_heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@ def _is_accepted_report(payload: dict[str, Any]) -> tuple[bool, str]:

def _send_telegram(message: str) -> bool:
targets: list[tuple[str, str]] = []
crisis_token = os.environ.get("CRISIS_ALERT_TELEGRAM_BOT_TOKEN")
for chat_id in _split_values(os.environ.get("CRISIS_ALERT_TELEGRAM_CHAT_IDS")):
if crisis_token:
targets.append((crisis_token, chat_id))
token = os.environ.get("TELEGRAM_TOKEN") or os.environ.get("TG_TOKEN")
for chat_id in _split_values(os.environ.get("GLOBAL_TELEGRAM_CHAT_ID")):
if token:
Expand All @@ -301,7 +297,7 @@ def _send_telegram(message: str) -> bool:
if not unique_targets:
print("No Telegram token/chat configured; unable to send heartbeat alert.", file=sys.stderr)
return False
base_url = os.environ.get("CRISIS_ALERT_TELEGRAM_API_BASE_URL") or "https://api.telegram.org"
base_url = "https://api.telegram.org"
ok = True
for token_value, chat_id in unique_targets:
body = urllib.parse.urlencode({"chat_id": chat_id, "text": message}).encode()
Expand Down
44 changes: 22 additions & 22 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ def load_strategy_module(**env_overrides):
),
"IB_ACCOUNT_GROUP_CONFIG_SECRET_NAME": None,
"GLOBAL_TELEGRAM_CHAT_ID": None,
"CRISIS_ALERT_CHANNELS": None,
"CRISIS_ALERT_EMAIL_RECIPIENTS": None,
"CRISIS_ALERT_EMAIL_SENDER_EMAIL": None,
"CRISIS_ALERT_EMAIL_SENDER_PASSWORD": None,
"CRISIS_ALERT_EMAIL_SMTP_HOST": None,
"CRISIS_ALERT_EMAIL_SMTP_PORT": None,
"CRISIS_ALERT_EMAIL_SMTP_SECURITY": None,
"CRISIS_ALERT_PUSH_RECIPIENTS": None,
"CRISIS_ALERT_PUSH_PROVIDER": None,
"CRISIS_ALERT_PUSH_APP_TOKEN": None,
"CRISIS_ALERT_PUSH_ACCESS_TOKEN": None,
"CRISIS_ALERT_PUSH_API_BASE_URL": None,
"CRISIS_ALERT_PUSH_DEVICE": None,
"CRISIS_ALERT_PUSH_PRIORITY": None,
"CRISIS_ALERT_PUSH_TAGS": None,
"CRISIS_ALERT_PUSH_BODY_MAX_CHARS": None,
"CRISIS_ALERT_TELEGRAM_CHAT_IDS": None,
"CRISIS_ALERT_TELEGRAM_BOT_TOKEN": None,
"CRISIS_ALERT_TELEGRAM_API_BASE_URL": None,
"CRISIS_ALERT_TELEGRAM_PARSE_MODE": None,
"CRISIS_ALERT_TELEGRAM_DISABLE_WEB_PAGE_PREVIEW": None,
"CRISIS_ALERT_TELEGRAM_BODY_MAX_CHARS": None,
"STRATEGY_PLUGIN_ALERT_CHANNELS": None,
"STRATEGY_PLUGIN_ALERT_EMAIL_RECIPIENTS": None,
"STRATEGY_PLUGIN_ALERT_EMAIL_SENDER_EMAIL": None,
"STRATEGY_PLUGIN_ALERT_EMAIL_SENDER_PASSWORD": None,
"STRATEGY_PLUGIN_ALERT_EMAIL_SMTP_HOST": None,
"STRATEGY_PLUGIN_ALERT_EMAIL_SMTP_PORT": None,
"STRATEGY_PLUGIN_ALERT_EMAIL_SMTP_SECURITY": None,
"STRATEGY_PLUGIN_ALERT_PUSH_RECIPIENTS": None,
"STRATEGY_PLUGIN_ALERT_PUSH_PROVIDER": None,
"STRATEGY_PLUGIN_ALERT_PUSH_APP_TOKEN": None,
"STRATEGY_PLUGIN_ALERT_PUSH_ACCESS_TOKEN": None,
"STRATEGY_PLUGIN_ALERT_PUSH_API_BASE_URL": None,
"STRATEGY_PLUGIN_ALERT_PUSH_DEVICE": None,
"STRATEGY_PLUGIN_ALERT_PUSH_PRIORITY": None,
"STRATEGY_PLUGIN_ALERT_PUSH_TAGS": None,
"STRATEGY_PLUGIN_ALERT_PUSH_BODY_MAX_CHARS": None,
"STRATEGY_PLUGIN_ALERT_TELEGRAM_CHAT_IDS": None,
"STRATEGY_PLUGIN_ALERT_TELEGRAM_BOT_TOKEN": None,
"STRATEGY_PLUGIN_ALERT_TELEGRAM_API_BASE_URL": None,
"STRATEGY_PLUGIN_ALERT_TELEGRAM_PARSE_MODE": None,
"STRATEGY_PLUGIN_ALERT_TELEGRAM_DISABLE_WEB_PAGE_PREVIEW": None,
"STRATEGY_PLUGIN_ALERT_TELEGRAM_BODY_MAX_CHARS": None,
}
defaults.update(env_overrides)
if "RUNTIME_TARGET_JSON" not in defaults:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_request_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,8 @@ def fake_post(_url, *, json, timeout):
monkeypatch.setattr(strategy_module, "_handle_request", lambda: (_ for _ in ()).throw(RuntimeError("boom")))
monkeypatch.setattr(strategy_module, "TG_TOKEN", "token-1")
monkeypatch.setattr(strategy_module, "TG_CHAT_ID", "chat-1")
monkeypatch.setenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_BOT_TOKEN", "plugin-token")
monkeypatch.setenv("STRATEGY_PLUGIN_ALERT_TELEGRAM_CHAT_IDS", "plugin-chat")
monkeypatch.setattr(strategy_module.requests, "post", fake_post)

with strategy_module.app.test_request_context("/", method="POST"):
Expand Down
Loading
Loading