Skip to content

Commit

Permalink
feat(modules): custom module api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bouttier committed Nov 20, 2024
1 parent 8dbdad4 commit d01daa7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion backend/geonature/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def set_sentry_context():
current_app.config["DISABLED_MODULES"].append(module_code)
else:
module_blueprint.config = config[module_code]
app.register_blueprint(module_blueprint, url_prefix=f"/{module_code.lower()}")
url_prefix = current_app.config[module_code]["MODULE_API"]
app.register_blueprint(module_blueprint, url_prefix=url_prefix)

return app
6 changes: 5 additions & 1 deletion backend/geonature/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def get_module_config_path(module_code):

def get_module_config(module_dist):
module_code = module_dist.entry_points["code"].load()
config = {"MODULE_CODE": module_code, "MODULE_URL": f"/{module_code.lower()}"}
config = {
"MODULE_CODE": module_code,
"MODULE_URL": f"/{module_code.lower()}", # path to the module in the frontend
"MODULE_API": f"/{module_code.lower()}", # path to the module API
}
try:
config_schema = module_dist.entry_points["config_schema"].load()
except KeyError:
Expand Down

0 comments on commit d01daa7

Please sign in to comment.