aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/exts/directory/ldap.py
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-07-26 19:45:24 +0100
committerGravatar Joe Banks <[email protected]>2024-07-26 19:45:24 +0100
commitde325b60eb8dfcba5baffd6fe9c6dc6c022c1cf4 (patch)
treefcc6404fda4e5ce426a573958e668c8134f308ee /arthur/exts/directory/ldap.py
parentExpose a BONSAI_AVAILABLE flag from modules that depend on Bonsai (diff)
Confirm that LDAP is enabled and Bonsai is available on LDAP cogs load
Diffstat (limited to 'arthur/exts/directory/ldap.py')
-rw-r--r--arthur/exts/directory/ldap.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/arthur/exts/directory/ldap.py b/arthur/exts/directory/ldap.py
index 1960fb8..4c63a11 100644
--- a/arthur/exts/directory/ldap.py
+++ b/arthur/exts/directory/ldap.py
@@ -423,4 +423,10 @@ class LDAP(commands.Cog):
async def setup(bot: KingArthur) -> None:
"""Add the extension to the bot."""
- await bot.add_cog(LDAP(bot))
+ if ldap.BONSAI_AVAILABLE and freeipa.BONSAI_AVAILABLE and CONFIG.enable_ldap:
+ await bot.add_cog(LDAP(bot))
+ else:
+ logger.warning(
+ "Not loading LDAP sync utilities as LDAP dependencies are not available "
+ "or LDAP is disabled by config, see README.md for more."
+ )