mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
build_dsn: add assertion
like the systemcheck from 0c14962d92, but dynamically for those
environments (non-docker) in which the system-check might be skipped
This commit is contained in:
@@ -7,6 +7,10 @@ def _colon_port(port):
|
||||
|
||||
def build_dsn(base_url, project_id, public_key):
|
||||
parts = urllib.parse.urlsplit(base_url)
|
||||
|
||||
assert parts.scheme in ("http", "https"), "The BASE_URL setting must be a valid URL (starting with http or https)."
|
||||
assert parts.hostname, "The BASE_URL setting must be a valid URL. The hostname must be set."
|
||||
|
||||
return (f"{ parts.scheme }://{ public_key }@{ parts.hostname }{ _colon_port(parts.port) }" +
|
||||
f"{ parts.path }/{ project_id }")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user