Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
update config call
Browse files Browse the repository at this point in the history
  • Loading branch information
aplybeah committed Jul 10, 2024
1 parent 0fe4fdf commit 868b50e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion analytics/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ class DBSettings(PydanticBaseEnvConfig):
password: str = Field(alias="DB_PASSWORD")
ssl_mode: str = Field(alias="DB_SSL_MODE")
slack_bot_token: str = Field(alias="ANALYTICS_SLACK_BOT_TOKEN")
reporting_channel_id: str = Field(alias="ANALYTICS_REPORTING_CHANNEL_ID")
reporting_channel_id: str = Field(alias="ANALYTICS_REPORTING_CHANNEL_ID")

def get_db_settings() -> DBSettings:
return DBSettings()
4 changes: 2 additions & 2 deletions analytics/src/analytics/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ def show_and_or_post_results(
"""Optionally show the results of a metric and/or post them to slack."""
# defer load of settings until this command is called
# this prevents an error if ANALYTICS_SLACK_BOT_TOKEN env var is unset
from config import DBSettings
from config import get_db_settings

settings = DBSettings()
settings = get_db_settings()

# optionally display the burndown chart in the browser
if show_results:
Expand Down
4 changes: 2 additions & 2 deletions analytics/tests/integrations/test_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from slack_sdk import WebClient

from analytics.integrations.slack import FileMapping, SlackBot
from config import DBSettings
from config import get_db_settings

settings = DBSettings()
settings = get_db_settings()
client = WebClient(token=settings.slack_bot_token)


Expand Down

0 comments on commit 868b50e

Please sign in to comment.