-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSTUF Interface refactoring (IServices) #389
RSTUF Interface refactoring (IServices) #389
Conversation
eb235a3
to
34b7a82
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #389 +/- ##
===========================================
+ Coverage 99.43% 100.00% +0.56%
===========================================
Files 12 12
Lines 884 898 +14
===========================================
+ Hits 879 898 +19
+ Misses 5 0 -5
☔ View full report in Codecov by Sentry. |
- The old `repository.refresh_settings` handling the IServices configuration was moved to the `interfaces` - Now the way to importa a `I{Services}` uses directly the dynaconf - Adds better error mensages for wrong configuration - Support a service has one setting with multiple environment variables what is helpful for third-part libraries that uses environment vars Signed-off-by: Kairo de Araujo <[email protected]>
34b7a82
to
3c240a1
Compare
@classmethod | ||
def from_dynaconf(cls, settings: Dynaconf) -> None: | ||
""" | ||
Run actions to test, configure using the settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run actions to test, configure using the settings. | |
Run actions to test and configure using the settings. |
@@ -47,18 +55,26 @@ def get(self, public_key: Key) -> Signer: | |||
class IStorage(ABC): | |||
@classmethod | |||
@abstractmethod | |||
def configure(cls, settings: Any) -> None: | |||
def configure(cls, settings: Dynaconf) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to annotate the settings arg at IkeyVault.configure
as well?
@@ -79,3 +95,79 @@ def put( | |||
Stores file bytes within a file with a specific filename. | |||
""" | |||
raise NotImplementedError # pragma: no cover | |||
|
|||
|
|||
def _setup_service_dynaconf(cls: Any, backend: Any, settings: Dynaconf): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: to be even more precise you can create a class called IService
and make both IkeyVault
and IStorage
inherit it, then here the cls
will be cls: IService
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have new contributors, it would be good to have it as a Good First Issue for someone who wants to understand the RSTUF Worker IServices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_cls, test_settings.RSTUF_FAKE_BACKEND, test_settings | ||
) | ||
|
||
assert "Invalid Interface IFake" in str(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test function is duplicating the first one.
- Improve the comments - Implement a better test for the all settings None - Add asserts related to the stub Signed-off-by: Kairo de Araujo <[email protected]>
a2a69cf
to
e745c25
Compare
Superseded: #397. |
repository.refresh_settings
handling the IServicesconfiguration was moved to the
interfaces
I{Services}
uses the dynaconf directlywhat is helpful for third-party libraries that use environment vars