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

🐝 Validate trailing slashes of envs #3995

Merged
merged 3 commits into from
Feb 25, 2025
Merged
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: 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)