multi: add accounts service to status manager

Add the accounts service to status manager. This will allow us to query
the status of the accounts service and see if it is running or not.
For incoming gRPC requests to the accounts service, we also use the
status manager to check if the accounts service is running or not to
determine if we should let the request through or not.
This commit is contained in:
Viktor Tigerström 2023-09-21 02:01:38 +02:00
parent 6f9f3244fb
commit ec2a7a39b4
No known key found for this signature in database
GPG key ID: B984570980684DCC
4 changed files with 31 additions and 27 deletions

View file

@ -623,6 +623,9 @@ func (p *rpcProxy) checkSubSystemStarted(requestURI string) error {
switch {
case handled:
case isAccountsReq(requestURI):
system = subservers.ACCOUNTS
case p.permsMgr.IsSubServerURI(subservers.LIT, requestURI):
system = subservers.LIT
@ -694,3 +697,13 @@ func isProxyReq(uri string) bool {
uri, fmt.Sprintf("/%s", litrpc.Proxy_ServiceDesc.ServiceName),
)
}
// isAccountsReq returns true if the given request is intended for the
// litrpc.Accounts service.
func isAccountsReq(uri string) bool {
return strings.HasPrefix(
uri, fmt.Sprintf(
"/%s", litrpc.Accounts_ServiceDesc.ServiceName,
),
)
}