diff --git a/cookbook/slackbot/settings.py b/cookbook/slackbot/settings.py index 8c5789fcb..1e1a88d1c 100644 --- a/cookbook/slackbot/settings.py +++ b/cookbook/slackbot/settings.py @@ -1,3 +1,4 @@ +import os from pathlib import Path from typing import ClassVar, Literal @@ -66,7 +67,12 @@ def validate_log_level(cls, v: str) -> str: def slack_api_token(self) -> str: from prefect.blocks.system import Secret - return Secret.load("test-slack-api-token", _sync=True).get() # type: ignore + if self.test_mode: + return Secret.load("test-slack-api-token", _sync=True).get() # type: ignore + else: + token = os.getenv("MARVIN_SLACK_API_TOKEN") + assert token is not None, "MARVIN_SLACK_API_TOKEN is not set" + return token settings = SlackbotSettings()