Ldap config settings from DB #630
-
Hello, I am trying to obtain the ldap configuration from the database, not from the .env. To do this, I made a provider that handles the connection to the server and obtains the data from the database. But when I do a test it doesn't connect. But the Laravel logs show me that it tries to connect twice. The first one gets the server from the database and the second one gets a null server, that's why the connection error occurs. Any ideas on how to do this or what could be wrong? Log when execute php artisan ldap:test:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @orebarranco, Registering the https://ldaprecord.com/docs/core/v3/quickstart Looking at how LdapRecord-Laravel itself registers configured connections will help you here: LdapRecord-Laravel/src/LdapServiceProvider.php Lines 89 to 115 in 02867cc |
Beta Was this translation helpful? Give feedback.
Hi @orebarranco,
Registering the
Connection
as a singleton in Laravel won't hook into LdapRecord as you're expecting here. You will need to register this connection outside of the singleton closure and directly into theLdapRecord\Container
as shown in the documentation:https://ldaprecord.com/docs/core/v3/quickstart
Looking at how LdapRecord-Laravel itself registers configured connections will help you here:
LdapRecord-Laravel/src/LdapServiceProvider.php
Line 34 in 02867cc
LdapRecord-Laravel/src/LdapServiceProvider.php
Lines 89 to 115 in 02867cc