Skip to content

Commit

Permalink
🐝 Validate trailing slashes of envs (#3995)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marigold authored Feb 25, 2025
1 parent f6e2bc7 commit dd60080
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions etl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,3 +589,14 @@ def read_sqls(self, sql: List[str], *args, **kwargs) -> List[pd.DataFrame]:
DB_HOST=DB_HOST,
)
)


# Validate config
def no_trailing_slash(url: str | None) -> None:
if url is not None and url.endswith("/"):
raise ValueError(f"Env {url} should not have a trailing slash.")


env_vars = [ADMIN_HOST, TAILSCALE_ADMIN_HOST, DATA_API_URL, BAKED_VARIABLES_PATH, R2_SNAPSHOTS_PUBLIC_READ]
for env_var in env_vars:
no_trailing_slash(env_var)

0 comments on commit dd60080

Please sign in to comment.