LSIF: Guard all backend actions behind enterprise
Created by: efritz
Summary: Ensure that LSIF-related resolvers and the lsif-server proxy is only registered when running in enterprise mode. See this slack thread for motivation.
What changed:
- GraphQL changes:
- Move
lsif_*.gofromgraphqlbackendtoenterprise/codeintelligence/resolvers. This is the bulk of the change as it required updating imports and reshuffling some of the code. No logic changed except for the creation of the commit resolver for lsif dumps (seeLsifDumpsmethod in the resolver). - Add
graphqlbackend/code_intelligence.go, which defines the interfaces for each resolver and updates the implementation of schemaResolver to call the optionally-boundCodeIntelligenceResolver - Update concrete uses of old resolvers in
graphqlbackendto use the interfaces defined in the bullet point above. - Add
Typemethod toRepositoryResolverso that we can get the repository db record from a resolver. I didn't see another way to do this and I was previously using package-private variables. Feedback welcome on this point. - Renamed variable
onlyInEnterprisetoa8nOnlyInEnterpriseto avoid conflicts between a8n and codeintelligence resolvers. This keeps the text of the error relevant to the endpoint that emits it.
- Move
- HTTP changes:
- Move the LSIF endpoints into
enterprise/codeintelligence/lsifserver/proxy. - Add a non-internal package in the frontend
httpapiwhich only contains a constant for the LSIF server proxy struct. This is set by enterprise mode. This change was meant to reflect the same way resolvers are set in the enterprise frontend for graphqlbackend (there is both an internal and non-internal version). - Update LSIF route registration to use the variable described in the bullet point above. If that variable is not set, then register a dummy "404 feature not enabled" endpoint.
- Move the LSIF endpoints into