Closed vicmarconi closed 1 year ago
Hi @vicmarconi,
Loading from the .env
file should be working, as there's tests ensuring this is the case and I have my own app loading connections from my .env
file.
Delete your config/ldap.php
file and try testing again. If the test displays your username from your .env
file, then it's successfully loading the connection. Ensure that you've wrapped your LDAP_DEFAULT_USERNAME
and LDAP_DEFAULT_BASE_DN
and LDAP_DEFAULT_PASSWORD
inside of quotes, otherwise the equals signs (and other special characters) may break parsing the .env
file. For example:
LDAP_DEFAULT_USERNAME="cn=admin,dc=local,dc=com"
For another test, jump into the vendor directory and dd()
here:
For example:
$connections = array_filter(
array_map('trim', explode(',', env('LDAP_CONNECTIONS', '')))
);
dd($connections);
Then run php artisan ldap:test
again. You should see your .env
connection printed:
> php artisan ldap:test
array:1 [
0 => "default"
]
If not, then your .env
file is not being properly loaded.
Closing due to inactivity.
Environment:
Describe the bug: I think the .ENV file configurations are not being properly loaded.
The output of artisan ldap:test was: ldap_bind(): Unable to bind to server: Can't contact LDAP server. Error Code: [-1] Diagnostic Message: null (it also showed my username - so I think it might be reading something from the .env)
But when I published the ldap.php config file and "hardcoded" the values there, it connected successfully.
Perhaps it's not a bug, but the documentation says that we can use either a published config or the .env