Repository navigation
Expressing branching configurations with configurl #656
fortuna
started this conversation in
API Proposals and Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Configurl makes it easy to compose components in a linear chain. Some components need multiple independently configured inputs:
Embedding config URLs inside other URLs becomes difficult to read because of escaping. Could we express these branches using markers within the existing pipe-separated format?
For example, assuming a
doqresolver component:The final
hecomponent would create a Happy Eyeballs stream dialer with these inputs:Resolver:
Dialer:
The common prefix supplies the base for both branches. The markers identify where that prefix ends and where each branch ends.
One possible implementation is for the
heparser to inspect the configuration on its left, construct the two branch configurations, and build the resolver and dialer through the registry. This would preserve the existing URL-chain syntax without another layer of URL escaping.With the generic registry proposed in #647, a component library could implement this independently, without changing the registry API or requiring SDK approval.
Naming and grouping
The marker names are open for discussion. Some possibilities are:
This explicitly labels both inputs and keeps
heas the component that combines them.This removes the final
he, but would givehe-resolverresponsibility for completing the group and producing the result.This is shorter: the final
heimplicitly ends the resolver branch and combines the inputs.There is also a naming-direction question. Configurations are written left to right, but construction starts with the rightmost component and follows its dependencies to the left.
he-endcould mean “stop collecting inputs here,” whilehe-basedescribes the common prefix’s role. Which is easier to understand?A generic map
Instead of component-specific markers, we could collect named branches into a map:
Each entry would use the same common prefix, producing:
The
hecomponent would consume those entries. The same mechanism could collecttcpandudpinputs for an Outline-client component.One possibility is for the map to hold configurations rather than constructed objects. Then
hewould requestresolveras adns.Resolveranddialeras atransport.StreamDialer. The map mechanism would not need to know those types in advance.This raises several questions:
startandendfollow reading order or construction order?This is an idea to explore separately from the current registry changes.
All reactions