Skip to content

Commit 2a8170a

Browse files
Merge branch 'main' into CAT-1522
2 parents b52151c + 504bc6a commit 2a8170a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Added
1111

1212
- Added environment variables `HIDE_PRIVATE_DATA` and `PRIVATE_DATA_FIELD` to control visibility of private technical data fields in SFEOS responses. [#518](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/518)
13+
- Added validator for `REDIS_MAX_CONNECTIONS` to handle empty or null-like values ("", "null", None) and return None instead. [#519](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/519)
1314

1415
### Changed
1516

stac_fastapi/core/stac_fastapi/core/redis_utils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ def validate_db_sentinel(cls, v: int) -> int:
3636
raise ValueError("REDIS_DB must be a positive integer")
3737
return v
3838

39+
@field_validator("REDIS_MAX_CONNECTIONS", mode="before")
40+
@classmethod
41+
def validate_max_connections(cls, v):
42+
"""Handle empty/None values for REDIS_MAX_CONNECTIONS."""
43+
if v in ["", "null", "Null", "NULL", "none", "None", "NONE", None]:
44+
return None
45+
return v
46+
3947
@field_validator("REDIS_SELF_LINK_TTL")
4048
@classmethod
4149
def validate_self_link_ttl_sentinel(cls, v: int) -> int:
@@ -118,6 +126,15 @@ def validate_db_standalone(cls, v: int) -> int:
118126
raise ValueError("REDIS_DB must be a positive integer")
119127
return v
120128

129+
130+
@field_validator("REDIS_MAX_CONNECTIONS", mode="before")
131+
@classmethod
132+
def validate_max_connections(cls, v):
133+
"""Handle empty/None values for REDIS_MAX_CONNECTIONS."""
134+
if v in ["", "null", "Null", "NULL", "none", "None", "NONE", None]:
135+
return None
136+
return v
137+
121138
@field_validator("REDIS_SELF_LINK_TTL")
122139
@classmethod
123140
def validate_self_link_ttl_standalone(cls, v: int) -> int:

0 commit comments

Comments
 (0)