fix: Fix the url path pattern when generate nginx config
Fix the url path pattern when generate nginx config. Closes-Bug: #1970007 Change-Id: Ifadfee974189f7b1426f29b20f6b23642a45bfee
This commit is contained in:
parent
1ab2cec63b
commit
e50d2a6bc5
@ -91,12 +91,13 @@ def get_proxy_endpoints() -> Dict[str, ProxyEndpoint]:
|
|||||||
if raw_url.path:
|
if raw_url.path:
|
||||||
raw_path = PurePath(raw_url.path)
|
raw_path = PurePath(raw_url.path)
|
||||||
if len(raw_path.parts) > 1:
|
if len(raw_path.parts) > 1:
|
||||||
if (
|
if raw_path.match("*[%$](*_id)s"):
|
||||||
raw_path.match("%(tenant_id)s")
|
# glob-style pattern: *, ?, [], [!], [-]
|
||||||
or raw_path.match("AUTH_%(tenant_id)s")
|
# The url of endpoint maybe like:
|
||||||
or raw_path.match("$(project_id)s")
|
# 1. $(tenant_id)s or %(tenant_id)s
|
||||||
or raw_path.match("AUTH_$(project_id)s")
|
# 2. $(project_id)s or %(project_id)s
|
||||||
):
|
# 3. AUTH_$(tenant_id)s or AUTH_%(tenant_id)s
|
||||||
|
# 4. AUTH_$(project_id)s or AUTH_%(project_id)s
|
||||||
path = "" if str(raw_path.parents[1]) == "/" else raw_path.parents[1]
|
path = "" if str(raw_path.parents[1]) == "/" else raw_path.parents[1]
|
||||||
elif raw_path.match("v[0-9]") or raw_path.match("v[0-9][.][0-9]"):
|
elif raw_path.match("v[0-9]") or raw_path.match("v[0-9][.][0-9]"):
|
||||||
path = "" if str(raw_path.parents[0]) == "/" else raw_path.parents[0]
|
path = "" if str(raw_path.parents[0]) == "/" else raw_path.parents[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user