guardicore / guardicore/monkey

Leverage flask blueprints for resource registration

Open
#3,086 1 comment 0 reactions 0 assignees View on GitHub
Code Quality Complexity: Medium Impact: Medium Refactor
Dominant language
Python
Stars
7.1k
Forks
830
PR merge metrics
No merged PRs in 30d

Description

# Refactor

As more code gets segregated into modules on the island side, we can use blueprints to leverage registration of URL's for those modules.
Blueprints can improve code quality in the following ways:
- Remove the manual registration of resources. Blueprints should be able to traverse the directory/file and add resources automatically thus eliminating the need for `register_resources` methods all over the codebase (they are not even part of an interface, so they need to be called manually for each island module we create).
- URL's can have prefixes. For example authentication blueprint can have a prefix `/auth` and all resources registered from it will start with `/auth`. This would ease refactoring in case we want to refactor the URL structure and for example remove the `/api` in the beginning of urls. Now we would need to go through every single endpoint and change the url string.

## Component(s) to be refactored

Resource URL's, resource registration

## Explanation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.