-
Notifications
You must be signed in to change notification settings - Fork 41
feat(cas-backend): introduce fallback mechanism #2629
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
Signed-off-by: Sylwester Piskozub <[email protected]>
| // Attempts to use the default backend first, if invalid it uses the fallback backend. | ||
| func (uc *CASBackendUseCase) FindDefaultOrFallbackBackend(ctx context.Context, orgID string) (*CASBackend, error) { | ||
| // Find the default backend | ||
| defaultBackend, err := uc.FindDefaultBackend(ctx, orgID) |
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.
can defaultBackend be nil?
| backend, err := s.casUC.FindDefaultOrFallbackBackend(context.Background(), robotAccount.OrgID) | ||
| if err != nil { | ||
| if biz.IsNotFound(err) { | ||
| return nil, errors.NotFound("not found", "default CAS backend not found") |
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.
we might be able to use something called handle_errors?
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 error message is not accurate, let's try to use handle_errors
| if err != nil { | ||
| if biz.IsNotFound(err) { | ||
| return nil, errors.NotFound("not found", "default CAS backend not found") | ||
| } else if biz.IsErrValidation(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.
this should return ErrorCasBackendErrorReasonInvalid no?
Adds support for configuring a fallback CAS backend that is automatically used when the default backend becomes unavailable.
Changes
fallbackboolean field to CAS backendsdefaultandfallback--fallbackflag to allcasbackend addcommands.Example
During
attestation initcas backend is decided seamlessly, we will provide information on what cas backend was used in the attestation itself.