Skip to content

Feat: event api disable via event registry address#109

Open
blockchainluffy wants to merge 3 commits intomainfrom
feat/event-api-disable-flag
Open

Feat: event api disable via event registry address#109
blockchainluffy wants to merge 3 commits intomainfrom
feat/event-api-disable-flag

Conversation

@blockchainluffy
Copy link
Contributor

closes #106

return func(ctx *gin.Context) {
if config.DisableEventAPI {
err := sherror.NewHttpError(
"Service is unavailable.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should then align this error message with the 501 error, and have it as "Event API is disabled on this deployment" instead of "Service unavailable" which is usually with the 503 error code?

main.go Outdated
return
}
// Disable event API if event registry contract address is not configured
config.DisableEventAPI = shutterEventRegistryContractAddressStringified == ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps a more robust check would be to verify that the event registry is a valid Ethereum address and enable the corresponding services then?

err := sherror.NewHttpError(
"Service is unavailable.",
"Service is unavailable.",
http.StatusNotImplemented,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This new response is not reflected on the API docs, example here: https://github.com/shutter-network/shutter-api/blob/main/internal/service/crypto.go#L53 and in other endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API rollout gating: return 503 for unavailable event-based endpoints

2 participants