Skip to content

Commit d2b9152

Browse files
committed
docstring for generate_rule
1 parent 6dd40ec commit d2b9152

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

jupyterhub_traefik_proxy/traefik_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ def validate(self, obj, value):
2222

2323

2424
def generate_rule(routespec):
25+
"""Generate a traefik routing rule for a jupyterhub routespec
26+
27+
28+
- if a routespec doesn't start with a `/`, the first part is a hostname.
29+
- routespecs always end with `/`
30+
- routespecs are a path _prefix_, and should match anything under them
31+
- the root of the route without the trailing slash should match the rule,
32+
e.g. the routespec `/prefix/` should match `/prefix` and `/prefix/tree`
33+
34+
Traefik rule documentation: https://doc.traefik.io/traefik/routing/routers/#rule
35+
"""
36+
2537
# validate assumption that routespecs always end with '/'
2638
if not routespec.endswith("/"):
2739
raise ValueError("routespec must end with /")

0 commit comments

Comments
 (0)