cli icon indicating copy to clipboard operation
cli copied to clipboard

extract config into a dedicated module

Open ndeloof opened this issue 5 months ago • 3 comments

What I did

Extracted the config package into a dedicated (sub)module, so third-party component which need to interact with CLI config can use this codebase without inheriting the whole docker/cli dependencies

How I did it

moved code to a at top-level folder and created go.mod

How to verify it

Human readable description for the release notes

introduce github.com/docker/cli/config as an isolated go module for third-party software to access docker CLI configuration files

A picture of a cute animal (not mandatory but encouraged)

image

ndeloof avatar Jul 25 '25 14:07 ndeloof

It is already difficult to update / change anything related to the CLI config due to its broad usage internally and externally to Docker.

Sure, but they already do. Not being a separate go module obviously didn't prevented this usage

we should rather be decoupling third parties from the config by providing an alternative

that's still an option, I don't see how this PR would prevent such a move. If you want third-party to access cli/config with a dedicated "officially supported" package, you'll have to somehow deprecate code in docker/cli so they stop relying on this legacy

ndeloof avatar Jul 28 '25 05:07 ndeloof

I need to have a closer look at this one. These packages need sorting out altogether as there's parts that should be considered "exclusive" to the CLI itself (after all, the config-file was the config file for the CLI), and parts that became an implicit "API" (most notably the auth-config, which was embedded in the CLI config). Separate from that, these packages have a MUCH too broad scope. For the auth-config part, I've contemplated having a separate package (which could be for a "plain-text" credentials helper) that's embedded in the config, so that it can be used separate from the other parts of teh config.

But altogether, many parts are currently in an intermediate state, and moving it to a module as-is right now means we'll have to maintain those things forever (SemVer and such); at at least, we'd have to alias the module in the old location, otherwise we end up with issues if (indirect) dependencies expect the old location, which will break.

That's not to say that there's no problem to be fixed, but some work is needed before we can make this happen; in the meantime, it might be better to keep the status quo.

thaJeztah avatar Jul 28 '25 08:07 thaJeztah