os environment variables should take precedences over the defaults, f… (#2100)

This commit is contained in:
Alexis Yushin 2024-10-28 00:24:28 -07:00 committed by GitHub
parent 6c682befa8
commit 21c282e659
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,18 +130,18 @@ class ElasticStore(VectorStoreBase):
connect_kwargs = {} connect_kwargs = {}
elasticsearch_vector_config = vector_store_config.dict() elasticsearch_vector_config = vector_store_config.dict()
self.uri = elasticsearch_vector_config.get("uri") or os.getenv( self.uri = os.getenv(
"ELASTICSEARCH_URL", "localhost" "ELASTICSEARCH_URL", "localhost"
) ) or elasticsearch_vector_config.get("uri")
self.port = elasticsearch_vector_config.get("post") or os.getenv( self.port = os.getenv(
"ELASTICSEARCH_PORT", "9200" "ELASTICSEARCH_PORT", "9200"
) ) or elasticsearch_vector_config.get("post")
self.username = elasticsearch_vector_config.get("username") or os.getenv( self.username = os.getenv(
"ELASTICSEARCH_USERNAME" "ELASTICSEARCH_USERNAME"
) ) or elasticsearch_vector_config.get("username")
self.password = elasticsearch_vector_config.get("password") or os.getenv( self.password = os.getenv(
"ELASTICSEARCH_PASSWORD" "ELASTICSEARCH_PASSWORD"
) ) or elasticsearch_vector_config.get("password")
self.collection_name = ( self.collection_name = (
elasticsearch_vector_config.get("name") or vector_store_config.name elasticsearch_vector_config.get("name") or vector_store_config.name