mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-09 16:17:10 +02:00
more ldap lib optimization
This commit is contained in:
@@ -18,7 +18,7 @@ from .settings import LDAP_CONFIG, get_ldap_lib
|
||||
|
||||
###################### Config ##########################
|
||||
|
||||
LDAP_LIB = lambda: get_ldap_lib()[0]
|
||||
LDAP_LIB = lambda: get_ldap_lib()[0] # lazy load to avoid slow ldap lib import on startup
|
||||
|
||||
|
||||
class LdapBinary(BaseBinary):
|
||||
@@ -28,12 +28,12 @@ class LdapBinary(BaseBinary):
|
||||
|
||||
provider_overrides: Dict[BinProviderName, ProviderLookupDict] = {
|
||||
VENV_PIP_BINPROVIDER.name: {
|
||||
"abspath": lambda: LDAP_LIB() and Path(inspect.getfile(LDAP_LIB())),
|
||||
"version": lambda: LDAP_LIB() and SemVer(LDAP_LIB().__version__),
|
||||
"abspath": lambda: LDAP_LIB() and Path(inspect.getfile(LDAP_LIB())), # type: ignore
|
||||
"version": lambda: LDAP_LIB() and SemVer(LDAP_LIB().__version__), # type: ignore
|
||||
},
|
||||
SYS_PIP_BINPROVIDER.name: {
|
||||
"abspath": lambda: LDAP_LIB() and Path(inspect.getfile(LDAP_LIB())),
|
||||
"version": lambda: LDAP_LIB() and SemVer(LDAP_LIB().__version__),
|
||||
"abspath": lambda: LDAP_LIB() and Path(inspect.getfile(LDAP_LIB())), # type: ignore
|
||||
"version": lambda: LDAP_LIB() and SemVer(LDAP_LIB().__version__), # type: ignore
|
||||
},
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@ class LdapConfig(BaseConfigSet):
|
||||
self.update_in_place(LDAP_ENABLED=False)
|
||||
|
||||
# Check that all required LDAP config options are set
|
||||
if self.self.LDAP_CONFIG_IS_SET:
|
||||
if self.LDAP_CONFIG_IS_SET:
|
||||
missing_config_options = [
|
||||
key for key, value in self.model_dump().items()
|
||||
if value is None and key != 'LDAP_ENABLED'
|
||||
|
Reference in New Issue
Block a user