Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurations are read inconsistently in registry tool command implementations #1231

Closed
timburks opened this issue Oct 13, 2023 · 2 comments · Fixed by #1232
Closed

Configurations are read inconsistently in registry tool command implementations #1231

timburks opened this issue Oct 13, 2023 · 2 comments · Fixed by #1232

Comments

@timburks
Copy link
Contributor

timburks commented Oct 13, 2023

Unfortunately #1230 didn't fully fix #1228.

This now works:

$ registry --config /tmp/apiz config list
registry.address = apiz.timbx.me:443
registry.insecure = false
registry.project = catalog
token-source = echo "ok"

Your active configuration is: "/tmp/apiz".

But this doesn't:

$ registry --config /tmp/apiz get projects
Usage:
...
Error: open /home/tim/.config/registry/apiz: no such file or directory
Run 'registry --help' for usage.

I can't explain why one of these commands should be getting its configuration differently from the other, but I observe that registry config list calls config.ActiveRaw() here and registry get projects calls connection.ActiveConfig() here.

Looking further, I see that config.ActiveRaw() is only used by the registry config subcommands and registry auth print-token, and all the others use connection.ActiveConfig().

@theganyo do you know why we have two ways of doing this? Is there something to watch out for in merging them?

@theganyo
Copy link
Member

IIRC, ActiveRaw() returns exactly the contents of the config whereas ActiveConfig() returns a resolved set of vars that can include params and env var overrides.

@timburks
Copy link
Contributor Author

Another suspicious thing that I see is that connection.ActiveConfig() just directly reads the configuration instead of using config.ActiveRaw() or config.Active() (I think this is what it should be calling).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants