Skip to content

Commit

Permalink
token loading
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz committed Dec 22, 2024
1 parent 4ec7b3f commit 3e78f5c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cookbook/slackbot/settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from pathlib import Path
from typing import ClassVar, Literal

Expand Down Expand Up @@ -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()

0 comments on commit 3e78f5c

Please sign in to comment.