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

update the settings #60

Merged
merged 3 commits into from
Oct 24, 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
11 changes: 7 additions & 4 deletions openeo_fastapi/client/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ def ensure_endswith_slash(cls, v: str) -> str:
return v.__add__("/")

@validator("OIDC_POLICIES", pre=True)
def split_oidc_policies_str_to_list(cls, v: str) -> str:
def split_oidc_policies_str_to_list(cls, v: list) -> str:
"""Ensure the OIDC_POLICIES are split and formatted correctly."""

if isinstance(v, str):
# We shouldn't have a string here. But in some cases where the settings where taken from code and not an env variable
# the config function parse_env_var will not execute. Reclean the value here if that is the case.
v = [str(x) for x in v.split("&&") if x != ""]

if not v:
return v

Expand All @@ -86,8 +91,6 @@ def parse_env_var(cls, field_name: str, raw_val: str) -> Any:
"""Parse any variables and handle and csv lists into python list type."""
if field_name == "STAC_COLLECTIONS_WHITELIST":
return [str(x) for x in raw_val.split(",")]
elif field_name == "OIDC_ROLES":
return [str(x) for x in raw_val.split(",")]
elif field_name == "OIDC_POLICIES":
return [str(x) for x in raw_val.split("&&")]
return [str(x) for x in raw_val.split("&&") if x != ""]
return cls.json_loads(raw_val)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openeo-fastapi"
version = "2024.9.2"
version = "2024.10.1"
description = "FastApi implementation conforming to the OpenEO Api specification."
authors = ["Sean Hoyal <[email protected]>"]
readme = "README.md"
Expand Down
Loading