Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to use cerifi.where() to find the ca_certs #222

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Updated the pip_docker example to use stac-fastapi.elasticsearch 2.1.0 and the elasticsearch 8.11.0 docker image. [#216](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/216)
- Updated the Data Loader CLI tool to accept a base_url, a data directory, a custom collection id, and an option to use bulk insert. [#218](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/218)
- Changed the default `ca_certs` value to use `certifi.where()` to find the installed certificate authority. [#222](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/222)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import ssl
from typing import Any, Dict, Set

import certifi

from elasticsearch import AsyncElasticsearch, Elasticsearch # type: ignore
from stac_fastapi.types.config import ApiSettings

Expand Down Expand Up @@ -31,9 +33,7 @@ def _es_config() -> Dict[str, Any]:

# Include CA Certificates if verifying certs
if config["verify_certs"]:
config["ca_certs"] = os.getenv(
"CURL_CA_BUNDLE", "/etc/ssl/certs/ca-certificates.crt"
)
config["ca_certs"] = os.getenv("CURL_CA_BUNDLE", certifi.where())

# Handle authentication
if (u := os.getenv("ES_USER")) and (p := os.getenv("ES_PASS")):
Expand Down
5 changes: 2 additions & 3 deletions stac_fastapi/opensearch/stac_fastapi/opensearch/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ssl
from typing import Any, Dict, Set

import certifi
from opensearchpy import AsyncOpenSearch, OpenSearch

from stac_fastapi.types.config import ApiSettings
Expand Down Expand Up @@ -32,9 +33,7 @@ def _es_config() -> Dict[str, Any]:

# Include CA Certificates if verifying certs
if config["verify_certs"]:
config["ca_certs"] = os.getenv(
"CURL_CA_BUNDLE", "/etc/ssl/certs/ca-certificates.crt"
)
config["ca_certs"] = os.getenv("CURL_CA_BUNDLE", certifi.where())

# Handle authentication
if (u := os.getenv("ES_USER")) and (p := os.getenv("ES_PASS")):
Expand Down