Skip to content

Commit

Permalink
Don't load cogs if required env var is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed Aug 24, 2024
1 parent 7f1562f commit db19eeb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arthur/exts/grafana/github_team_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,15 @@ async def sync_teams(self, ctx: commands.Context) -> None:


async def setup(bot: KingArthur) -> None:
"""Add cog to bot."""
if CONFIG.grafana_token and CONFIG.github_token:
await bot.add_cog(GrafanaGitHubTeamSync(bot))
else:
"""Add GrafanaGitHubTeamSync cog to bot."""
if not all(
CONFIG.github_org,
CONFIG.github_token,
CONFIG.grafana_url,
CONFIG.grafana_token,
):
logger.warning(
"Not loading Grafana Github team sync as grafana_token and/or github_token are not set"
"Not loading GrafanaGitHubTeamSync team as a required config entry is missing. See README"
)
return
await bot.add_cog(GrafanaGitHubTeamSync(bot))

0 comments on commit db19eeb

Please sign in to comment.