Skip to content

Commit 7329ba4

Browse files
committed
Global read ptype config
1 parent c1619c7 commit 7329ba4

File tree

1 file changed

+2
-4
lines changed
  • services/common/rs_server_common/utils

1 file changed

+2
-4
lines changed

services/common/rs_server_common/utils/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
Path(osp.realpath(osp.dirname(__file__))).parent.parent / "config" / "product_type_mapping.yaml"
3838
)
3939
PTYPE_MAPPING_FILE = Path(os.environ.get("PTYPE_MAPPING_CONFIG", LOCAL_PTYPE_MAPPING_FILE))
40+
with PTYPE_MAPPING_FILE.open("r", encoding="utf-8") as f:
41+
product_type_data = yaml.safe_load(f)["types"]
4042

4143

4244
def validate_str_list(parameter: str) -> list | str:
@@ -316,10 +318,6 @@ def extract_eo_product(eo_product: EOProduct, mapper: dict) -> dict:
316318

317319
def _apply_product_facets(feature: dict, _odata: dict) -> None:
318320
"""Sets product:type, processing:level - temporary hardcoded until RSPY-760 is DONE"""
319-
320-
with PTYPE_MAPPING_FILE.open("r", encoding="utf-8") as f:
321-
product_type_data = yaml.safe_load(f)["types"]
322-
323321
props: dict[str, str] = feature["properties"]
324322
if not (
325323
all(k in props for k in ("product:type", "processing:level"))

0 commit comments

Comments
 (0)