Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional teams messages #523

Merged
merged 16 commits into from
Mar 28, 2024
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
8 changes: 5 additions & 3 deletions openstef/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
class AppSettings(BaseSettings):
"""Global app settings."""

# Logging settings.
log_level: str = Field("INFO", description="Log level used for logging statements.")

model_config = SettingsConfigDict(
env_prefix="openstef_", env_file=".env", extra="ignore"
)

post_teams_messages: bool = True

# Logging settings.
log_level: str = Field("INFO", description="Log level used for logging statements.")
2 changes: 1 addition & 1 deletion openstef/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Openstef custom exceptions."""


# Define custom exception
# Define custom exceptions
class NoPredictedLoadError(Exception):
"""No predicted load for given datatime range."""

Expand Down
3 changes: 3 additions & 0 deletions openstef/monitoring/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def post_teams(
Note:
This function is namespace-specific.
"""
if not Settings.post_teams_messages:
return

structlog.configure(
wrapper_class=structlog.make_filtering_bound_logger(
logging.getLevelName(Settings.log_level)
Expand Down
Loading