diff --git a/cerulean_cloud/cloud_function_ais_analysis/main.py b/cerulean_cloud/cloud_function_ais_analysis/main.py index 90d68410..60acfc74 100644 --- a/cerulean_cloud/cloud_function_ais_analysis/main.py +++ b/cerulean_cloud/cloud_function_ais_analysis/main.py @@ -60,7 +60,7 @@ async def handle_aaa_request(request): if len(slicks_without_sources) > 0: ais_constructor = AISConstructor(s1) ais_constructor.retrieve_ais() - if ais_constructor.ais_df: + if not ais_constructor.ais_df.empty: ais_constructor.build_trajectories() ais_constructor.buffer_trajectories() for slick in slicks_without_sources: diff --git a/cerulean_cloud/cloud_run_tipg/handler.py b/cerulean_cloud/cloud_run_tipg/handler.py index a82a1d89..bad60019 100644 --- a/cerulean_cloud/cloud_run_tipg/handler.py +++ b/cerulean_cloud/cloud_run_tipg/handler.py @@ -9,6 +9,7 @@ - DATABASE_URL """ +import json import logging import os from typing import Any, List, Optional @@ -64,11 +65,16 @@ def extract_table_from_request(request: Request) -> Optional[str]: def get_env_list(env_var: str, default: List[str] = None) -> List[str]: - """Get a list from an environment variable. Assumes values are comma-separated.""" + """ + Turn a list of strings in the .env into a list of strings in the code + """ raw_value = os.environ.get(env_var) if raw_value is None: return default if default is not None else [] - return raw_value.split(",") + try: + return json.loads(raw_value) + except json.JSONDecodeError: + return raw_value.split(",") class AccessControlMiddleware(BaseHTTPMiddleware):