diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-09-05 21:23:41 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-09-08 17:44:57 +0300 |
commit | 70c1cdfd8f34472761fe5ec97f0713990c1b4f5b (patch) | |
tree | f2e631c10563bcc0cde07e4359c11b800a188d86 /mod/mod-repository-root.cxx | |
parent | 3be834183ae36c321e4b560dce9a63cee846e63d (diff) |
Add multi-tenancy support
Diffstat (limited to 'mod/mod-repository-root.cxx')
-rw-r--r-- | mod/mod-repository-root.cxx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mod/mod-repository-root.cxx b/mod/mod-repository-root.cxx index 3b0ab1f..b8777fd 100644 --- a/mod/mod-repository-root.cxx +++ b/mod/mod-repository-root.cxx @@ -275,13 +275,27 @@ namespace brep if (!rpath.sub (root)) return false; - const path& lpath (rpath.leaf (root)); + path lpath (rpath.leaf (root)); + + if (!lpath.empty ()) + { + path::iterator i (lpath.begin ()); + const string& s (*i); + + if (s[0] == '@' && s.size () > 1) + { + tenant = string (s, 1); + lpath = path (++i, lpath.end ()); + } + } // Delegate the request handling to the selected sub-handler. Intercept // exception handling to add sub-handler attribution. // - auto handle = [&rq, &rs, this] (const char* nm, bool fn = false) -> bool + auto handle = [&rq, &rs, this] (const char* nm, bool fn = false) { + handler_->tenant = move (tenant); + try { // Delegate the handling straight away if the sub-handler is not a |