You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go api with custom registry
[11:56]
OP
Viacheslav Terdunov: There's example of using Go API with the Central modules registry https://cuelang.org/docs/tutorial/using-modules-with-go-api/#step-7
Could you please help me understand how to work with a custom registry?
I'm not sure if this is the correct way to build a modregistry.Registry instance
How can I configure the registry address and pathEncoding: "hashAsTag" (I'm using AWS ECR as an OCI repo)
I've tried something like this
resolver, _ := modconfig.NewResolver(nil)
client := modregistry.NewClientWithResolver(resolver)
reg, _ := modcache.New(client, "")
# then load
buildInstances := load.Instances(cuesFiles, &load.Config{
Dir: ".",
Registry: reg,
})
[12:54]mvdan: have you seen https://pkg.go.dev/cuelang.org/go/cue/load#example-package-ExternalModules ?
[12:56]mvdan: cuelang.org should have a little bit of content about using the Go API with custom registries. https://cuelang.org/docs/tutorial/using-modules-with-go-api/ covers the Go API, and https://cuelang.org/docs/tutorial/working-with-a-custom-module-registry/ covers custom registries, but we don't have a combination of both. I think a small example in the latter page makes sense.
[13:57]mvdan: I also think we should nudge cue/load users towards setting CUE_REGISTRY in load.Config.Env; even though it's a stringy API, it's much higher level and easier to use than chaining modconfig, modcache, and modregistry
The text was updated successfully, but these errors were encountered:
We don't currently cover the use of a custom module registry with the Go API either on https://cuelang.org/docs/tutorial/using-modules-with-go-api/ or https://cuelang.org/docs/tutorial/working-with-a-custom-module-registry/.
We should address this -- possibly by including an example on the latter page, although that page is already quite long.
Original Discord thread that contains some useful pointers:
https://discord.com/channels/1238032673109311508/1324707977126608969/1324707977126608969
The text was updated successfully, but these errors were encountered: