Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

fixed aca-py config #549

Merged
merged 4 commits into from
Jul 15, 2021

Conversation

etschelp
Copy link
Contributor

@etschelp etschelp commented Jul 15, 2021

only checking for is present is not enough as it ignores if a value is true or false. added a getUnwrapped() method to the wrapper and fixed the class.

Signed-off-by: Philipp Etschel philipp.etschel@ch.bosch.com

Signed-off-by: Philipp Etschel <philipp.etschel@ch.bosch.com>
Signed-off-by: Philipp Etschel <philipp.etschel@ch.bosch.com>
Boolean autoAcceptInvites;
Boolean autoAcceptRequests;
Boolean autoRespondMessages;
private Boolean autoRespondCredentialOffer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about this?

making all switches boolean autoAcceptInvites=false
and read the config like this:
Boolean.TRUE.equals(c.getUnwrapped("debug.auto_accept_invites", Boolean.class))

this would make consuming the config easier, as long as configuration absence is interpreted as false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I'm only hesitant to set default values because that can change semantics (in theory), but as aca-py does not return a value in the config if the flag is set to false the meaning stays the same anyway. Also it was working before, but like this it is cleaner and also keeps working if this behavior should change.

@@ -55,7 +55,7 @@
}

public boolean isConnectionRequestTask() {
return acaPyConfig.getAutoAcceptRequests() != null && !acaPyConfig.getAutoAcceptRequests();
return acaPyConfig.getAutoAcceptRequests() == null || !acaPyConfig.getAutoAcceptRequests();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works with my suggestion
!acaPyConfig.getAutoAcceptRequests()

@Nullable
public PartnerAPI getPartner(@NonNull UUID id) {
PartnerAPI apiPartner = null;
Optional<Partner> dbPartner = repo.findById(id);
Copy link
Contributor

@l-wegner l-wegner Jul 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return repo.findById(id).map(converter::toAPIObject).orElse(null)

…ike this consuming classes do not need to do this.

Signed-off-by: Philipp Etschel <philipp.etschel@ch.bosch.com>
Signed-off-by: Philipp Etschel <philipp.etschel@ch.bosch.com>
@etschelp etschelp merged commit d7c4cb7 into hyperledger-labs:master Jul 15, 2021
@etschelp etschelp deleted the fix/aca-py-config branch July 15, 2021 11:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants