Open kriswuollett opened 4 months ago
If I'm not mistaken, that's what content_roots are for. Unfortunately, they seem to be undocumented.
If I'm not mistaken, that's what content_roots are for. Unfortunately, they seem to be undocumented.
Thanks. Seemed like it should work, but in the following example the grpc health protos are missing from the tree, but otherwise it looks like it stripped the prefix of just envoy protos:
name = "corp"
proto_out_dir = "protos"
[grpc_health_v1]
url = "github.com/grpc/grpc"
revision = "b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1" # v1.64.0
protocol = "https"
allow_policies = ["src/proto/grpc/health/v1/*"]
content_roots = ["src/proto"]
[envoy_api_v2]
url = "github.com/envoyproxy/envoy"
revision = "72d653e2540cc5f77e2acdc1c9a57a10263d74dc"
protocol = "https"
allow_policies = ["src/api/envoy/api/v2/*"]
content_roots = ["src/api"]
It's difficult to try different variations due to #27 without creating minimal sample repos -- I can't just delete the source tree.
Perhaps my use case is not supported as I don't have "any protos of my own"?
Use case is building a server that provides two services, the grpc health protocol for status checks, and a sidecar for Envoy.
I could specify my dependency roots from files, but realistically I'd just need to list fully qualified gRPC service names.
This works good enough for now even though it fetches more than I need, but I think this prefix on its own is just a documentation issue as mentioned above in https://github.com/coralogix/protofetch/issues/138#issuecomment-2137799809:
name = "corp"
[envoy]
url = "github.com/envoyproxy/envoy"
revision = "72d653e2540cc5f77e2acdc1c9a57a10263d74dc"
protocol = "https"
allow_policies = ["envoy/*"]
content_roots = ["api"]
[grpc_health_v1]
url = "github.com/grpc/grpc"
# v1.64.0
revision = "b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1"
protocol = "https"
allow_policies = ["grpc/health/v1/*"]
content_roots = ["src/proto"]
Perhaps it is just a configuration mistake, but I suspect
protofetch
works on the assumption that protos are stored at the root of a git repository. I'm usingproto_out_dir = "protos"
with the following dependency:Instead of finding a file at
protos/grpc/health/v1/health.proto
, it is actually atprotos/src/proto/grpc/health/v1/health.proto
. I assumed maybeprotofetch
had the logic to automatically strip prefixes based on the proto package name.I tried using
url = "github.com/grpc/grpc/src/proto"
as a configuration option to see if something like that was undocumented, but instead I get this error:If one wants to compile multiple unrelated proto dependency trees at once, I believe they need to be rooted in the same directory? Is there a way I am currently supposed to use
protofetch
so all my dependencies could end up in the same logical & physical directory tree?For example adding this to my config:
Fetching it (155 MB cached, 53 seconds):
The
QuicProtocolOptions
message is inprotos/api/envoy/api/v2/listener/quic_config.proto
notprotos/envoy/api/v2/listener/quic_config.proto
.