Skip to content

Commit

Permalink
If elasticsearch persistence is enabled, also persist opensearch
Browse files Browse the repository at this point in the history
  • Loading branch information
GREsau committed Nov 9, 2023
1 parent cf681e4 commit 9ae45d8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/localstack_persist/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def normalise_service_name(n: str):
return (
service_name = (
n.strip()
.lower()
.replace(
Expand All @@ -21,6 +21,9 @@ def normalise_service_name(n: str):
"",
)
)
if service_name == "elasticsearch":
return "es"
return service_name


PERSISTED_SERVICES = {"default": True}
Expand All @@ -42,6 +45,10 @@ def normalise_service_name(n: str):


def is_persistence_enabled(service_name: str):
return PERSISTED_SERVICES.get(
normalise_service_name(service_name), PERSISTED_SERVICES["default"]
)
service_name = normalise_service_name(service_name)

# elasticsearch requires opensearch
if service_name == "opensearch" and is_persistence_enabled("es"):
return True

return PERSISTED_SERVICES.get(service_name, PERSISTED_SERVICES["default"])

0 comments on commit 9ae45d8

Please sign in to comment.