File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed
elasticsearch/stac_fastapi/elasticsearch
opensearch/stac_fastapi/opensearch Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ def _es_config() -> Dict[str, Any]:
5252 if http_compress :
5353 config ["http_compress" ] = True
5454
55+ # Handle authentication
56+ if (u := os .getenv ("ES_USER" )) and (p := os .getenv ("ES_PASS" )):
57+ config ["http_auth" ] = (u , p )
58+
5559 # Explicitly exclude SSL settings when not using SSL
5660 if not use_ssl :
5761 return config
@@ -64,10 +68,6 @@ def _es_config() -> Dict[str, Any]:
6468 if config ["verify_certs" ]:
6569 config ["ca_certs" ] = os .getenv ("CURL_CA_BUNDLE" , certifi .where ())
6670
67- # Handle authentication
68- if (u := os .getenv ("ES_USER" )) and (p := os .getenv ("ES_PASS" )):
69- config ["http_auth" ] = (u , p )
70-
7171 return config
7272
7373
Original file line number Diff line number Diff line change @@ -40,18 +40,6 @@ def _es_config() -> Dict[str, Any]:
4040 if http_compress :
4141 config ["http_compress" ] = True
4242
43- # Explicitly exclude SSL settings when not using SSL
44- if not use_ssl :
45- return config
46-
47- # Include SSL settings if using https
48- config ["ssl_version" ] = ssl .PROTOCOL_SSLv23
49- config ["verify_certs" ] = get_bool_env ("ES_VERIFY_CERTS" , default = True )
50-
51- # Include CA Certificates if verifying certs
52- if config ["verify_certs" ]:
53- config ["ca_certs" ] = os .getenv ("CURL_CA_BUNDLE" , certifi .where ())
54-
5543 # Handle authentication
5644 if (u := os .getenv ("ES_USER" )) and (p := os .getenv ("ES_PASS" )):
5745 config ["http_auth" ] = (u , p )
@@ -65,6 +53,18 @@ def _es_config() -> Dict[str, Any]:
6553
6654 config ["headers" ] = headers
6755
56+ # Explicitly exclude SSL settings when not using SSL
57+ if not use_ssl :
58+ return config
59+
60+ # Include SSL settings if using https
61+ config ["ssl_version" ] = ssl .PROTOCOL_SSLv23
62+ config ["verify_certs" ] = get_bool_env ("ES_VERIFY_CERTS" , default = True )
63+
64+ # Include CA Certificates if verifying certs
65+ if config ["verify_certs" ]:
66+ config ["ca_certs" ] = os .getenv ("CURL_CA_BUNDLE" , certifi .where ())
67+
6868 return config
6969
7070
You can’t perform that action at this time.
0 commit comments