mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
more ldap lib optimization
This commit is contained in:
parent
89a066da0b
commit
c84ea81c5a
2 changed files with 6 additions and 6 deletions
|
@ -18,7 +18,7 @@ from .settings import LDAP_CONFIG, get_ldap_lib
|
||||||
|
|
||||||
###################### Config ##########################
|
###################### 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):
|
class LdapBinary(BaseBinary):
|
||||||
|
@ -28,12 +28,12 @@ class LdapBinary(BaseBinary):
|
||||||
|
|
||||||
provider_overrides: Dict[BinProviderName, ProviderLookupDict] = {
|
provider_overrides: Dict[BinProviderName, ProviderLookupDict] = {
|
||||||
VENV_PIP_BINPROVIDER.name: {
|
VENV_PIP_BINPROVIDER.name: {
|
||||||
"abspath": lambda: LDAP_LIB() and Path(inspect.getfile(LDAP_LIB())),
|
"abspath": lambda: LDAP_LIB() and Path(inspect.getfile(LDAP_LIB())), # type: ignore
|
||||||
"version": lambda: LDAP_LIB() and SemVer(LDAP_LIB().__version__),
|
"version": lambda: LDAP_LIB() and SemVer(LDAP_LIB().__version__), # type: ignore
|
||||||
},
|
},
|
||||||
SYS_PIP_BINPROVIDER.name: {
|
SYS_PIP_BINPROVIDER.name: {
|
||||||
"abspath": lambda: LDAP_LIB() and Path(inspect.getfile(LDAP_LIB())),
|
"abspath": lambda: LDAP_LIB() and Path(inspect.getfile(LDAP_LIB())), # type: ignore
|
||||||
"version": lambda: LDAP_LIB() and SemVer(LDAP_LIB().__version__),
|
"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)
|
self.update_in_place(LDAP_ENABLED=False)
|
||||||
|
|
||||||
# Check that all required LDAP config options are set
|
# 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 = [
|
missing_config_options = [
|
||||||
key for key, value in self.model_dump().items()
|
key for key, value in self.model_dump().items()
|
||||||
if value is None and key != 'LDAP_ENABLED'
|
if value is None and key != 'LDAP_ENABLED'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue