MCPcopy Index your code
hub / github.com/rilldata/rill / GetCurrentProject

Method GetCurrentProject

cli/pkg/local/server.go:656–680  ·  view source on GitHub ↗

GetCurrentProject implements localv1connect.LocalServiceHandler. Remove this endpoint once UI cleans up code referring to it.

(ctx context.Context, r *connect.Request[localv1.GetCurrentProjectRequest])

Source from the content-addressed store, hash-verified

654// GetCurrentProject implements localv1connect.LocalServiceHandler.
655// Remove this endpoint once UI cleans up code referring to it.
656func (s *Server) GetCurrentProject(ctx context.Context, r *connect.Request[localv1.GetCurrentProjectRequest]) (*connect.Response[localv1.GetCurrentProjectResponse], error) {
657 localProjectName := filepath.Base(s.app.ProjectPath)
658
659 // Return early if the user isn't logged in
660 if !s.app.ch.IsAuthenticated() {
661 return connect.NewResponse(&localv1.GetCurrentProjectResponse{
662 LocalProjectName: localProjectName,
663 }), nil
664 }
665
666 projects, err := s.app.ch.InferProjects(ctx, s.app.ch.Org, s.app.ProjectPath)
667 if err != nil {
668 if errors.Is(err, cmdutil.ErrInferProjectFailed) {
669 return connect.NewResponse(&localv1.GetCurrentProjectResponse{
670 LocalProjectName: localProjectName,
671 }), nil
672 }
673 return nil, err
674 }
675
676 return connect.NewResponse(&localv1.GetCurrentProjectResponse{
677 LocalProjectName: localProjectName,
678 Project: projects[0],
679 }), nil
680}
681
682func (s *Server) ListOrganizationsAndBillingMetadata(ctx context.Context, r *connect.Request[localv1.ListOrganizationsAndBillingMetadataRequest]) (*connect.Response[localv1.ListOrganizationsAndBillingMetadataResponse], error) {
683 // Get authenticated admin client

Callers

nothing calls this directly

Calls 2

IsAuthenticatedMethod · 0.80
InferProjectsMethod · 0.80

Tested by

no test coverage detected