aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/exts/directory/ldap.py
diff options
context:
space:
mode:
Diffstat (limited to 'arthur/exts/directory/ldap.py')
-rw-r--r--arthur/exts/directory/ldap.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/arthur/exts/directory/ldap.py b/arthur/exts/directory/ldap.py
index dd2fc6c..70fe1ab 100644
--- a/arthur/exts/directory/ldap.py
+++ b/arthur/exts/directory/ldap.py
@@ -427,10 +427,23 @@ class LDAP(commands.Cog):
async def setup(bot: KingArthur) -> None:
"""Add the extension to the bot."""
- if ldap.BONSAI_AVAILABLE and freeipa.BONSAI_AVAILABLE and CONFIG.enable_ldap:
- await bot.add_cog(LDAP(bot))
- else:
+ if not all(ldap.BONSAI_AVAILABLE, freeipa.BONSAI_AVAILABLE, CONFIG.enable_ldap):
logger.warning(
"Not loading LDAP sync utilities as LDAP dependencies are not available "
"or LDAP is disabled by config, see README.md for more."
)
+ return
+ if not all(
+ CONFIG.ldap_host,
+ CONFIG.ldap_bind_password,
+ CONFIG.ldap_certificate_location,
+ CONFIG.keycloak_address,
+ CONFIG.keycloak_password,
+ ):
+ logger.warning(
+ "Not loading LDAP sync utilities as one or more LDAP environment variables"
+ "are not set, see README.md for more."
+ )
+ return
+
+ await bot.add_cog(LDAP(bot))