-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get_requested_site: configurable backend to get the site for an API call
Description ----------- Dashboard needs to be able to access Figures API with privileged access by sending site's UUID parameter. This concept is Tahoe-specific and shouldn't make it into Figures (thanks John for advocating for that). Therefor this PR adds a plugin to customize the logic we use to `get_current_site()` I've added a Figures plugin repo to do that: - appsembler/tahoe-figures-plugins#1 Using the backend ----------------- - Install a package which has the custom backend e.g. `pip install tahoe-figures-plugins` - In the `server-vars.yml` configure Figures like below: ```yaml FIGURES: REQUESTED_SITE_BACKEND: 'tahoe_figures_plugins.sites:get_current_site_or_by_uuid' ``` Backward compatibility ---------------------- - By default this PR changes nothing for both community and Tahoe installations - The tests works as-is for all Figures views - The plugin only used when configured Benchmark --------- I tested the `import_from_path` function and the load takes 0.0069ms per call if the backend is already imported in the Python module system on a staging server. Loading the backend for the first time (e.g. a new Python gunicorn worker) takes 0.5ms. This seems like an acceptable delay to add on top of the each request.
- Loading branch information
1 parent
596df83
commit 932eeab
Showing
3 changed files
with
98 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters