-
Notifications
You must be signed in to change notification settings - Fork 49
fixed aca-py config #549
fixed aca-py config #549
Conversation
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; |
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.
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.
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.
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(); |
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.
this works with my suggestion
!acaPyConfig.getAutoAcceptRequests()
@Nullable | ||
public PartnerAPI getPartner(@NonNull UUID id) { | ||
PartnerAPI apiPartner = null; | ||
Optional<Partner> dbPartner = repo.findById(id); |
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.
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>
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