Repository navigation
Make the PLC directory URL configurable - #168
Merged
Merged
Conversation
Add --plc-url / COCOON_PLC_URL (default https://plc.directory) and thread it through the PLC client, the Passport DID resolver, and the OAuth permission-set resolver, so cocoon can run against a local PLC directory for testing. Closes #158
Use identity.DefaultPlcURL for the --plc-url flag default and the plc.Client fallback, and drop the hardcoded default from the docker-compose files (an empty value resolves to the same constant).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--plc-url/COCOON_PLC_URL(defaulthttps://plc.directory), so cocoon can run against a local PLC instance for integration testing without registering accounts in the real directory.Changes
--plc-urlflag /COCOON_PLC_URLenv var andserver.Args.PlcURL. The value is validated inserver.New(http/https scheme, host required, no query/fragment, trailing slash trimmed; empty → default). A warning is logged when a non-default directory is in use.plc.Clientnow uses the configured URL for DID creation, operation submission,/data, and/log/audit.identity.Passporttakes an optionalWithPlcURL(...)option and resolvesdid:plcdocuments against it.NewPassport(h, bc)remains source-compatible.scopes.NewIndigoResolverWithPLCURL, which uses indigo's default directory config withPLCURLoverridden.DidToDocUrl,FetchDidDoc,FetchDidData,FetchDidAuditLog, andResolveServicenow take an explicitplcURLargument (empty → default). Addsidentity.DefaultPlcURLandidentity.NormalizePlcURL.FetchDidAuditLognow uses the passed-in HTTP client rather thanhttp.DefaultClient.identity.DefaultPlcURL. The flag default and theplc.NewClientfallback both reference it.COCOON_PLC_URL. It is empty by default and resolves toidentity.DefaultPlcURL.Validation
CGO_ENABLED=1 go test -race ./...: all packages pass.go build ./...,go vet ./..., andgofmt -l .are clean.identity/identity_test.go: URL normalization,DidToDocUrl, the fetch helpers, andPassportagainst a fake PLChttptestserver.oauth/scopes/resolver_test.go: the resolver'sPLCURLoverride and its default.Review notes
identityhelper signature changes are breaking for anyone importinggithub.com/haileyok/cocoon/identityas a library. All in-repo callers are updated.NewIndigoResolverWithPLCURLtype-asserts indigo'sDefaultDirectory()internals (*CacheDirectory→*BaseDirectory). The unit test fails if an indigo bump changes that shape..well-known) anddid:webare unaffected.