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

connection.ActiveConfig() should use config.Active() instead of reading configuration directly #1232

Merged
merged 3 commits into from
Oct 16, 2023

Conversation

timburks
Copy link
Contributor

@timburks timburks commented Oct 13, 2023

Fixes #1231

config.Active() supports the --config flag where the previous code for connection.ActiveConfig() does not.

@timburks timburks requested a review from theganyo October 13, 2023 21:05
@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

Merging #1232 (94e5690) into main (f805290) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1232      +/-   ##
==========================================
- Coverage   71.98%   71.91%   -0.07%     
==========================================
  Files         146      146              
  Lines       12241    12250       +9     
==========================================
- Hits         8812     8810       -2     
- Misses       2747     2759      +12     
+ Partials      682      681       -1     
Files Coverage Δ
pkg/config/config.go 60.49% <100.00%> (+0.74%) ⬆️
pkg/connection/config.go 47.05% <100.00%> (-17.39%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@timburks
Copy link
Contributor Author

But now this doesn't work:

$ registry --config apiz apply -f .
Usage:
...

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

@timburks
Copy link
Contributor Author

Now with the latest changes, all of the following work:

# local config file with only a basename
$ registry --config apiz apply -f .
  INFO[0000] Applying apis/petstore    uid=57088557
  INFO[0000] 1 YAML file(s) applied (3 found, 1 with 'apiVersion: apigeeregistry/v1') uid=57088557

# local config file, multisegment path
$ registry --config ./apiz apply -f .
  INFO[0000] Applying apis/petstore    uid=a41eb5db
  INFO[0000] 1 YAML file(s) applied (3 found, 1 with 'apiVersion: apigeeregistry/v1') uid=a41eb5db

# config file in ~/.config/registry
$ mv apiz ~/.config/registry
$ registry --config apiz apply -f .
  INFO[0000] Applying apis/petstore    uid=0a8bbee3
  INFO[0000] 1 YAML file(s) applied (3 found, 1 with 'apiVersion: apigeeregistry/v1') uid=0a8bbee3

@timburks
Copy link
Contributor Author

Now with tests.

@timburks timburks merged commit 73a3c4e into apigee:main Oct 16, 2023
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Configurations are read inconsistently in registry tool command implementations
2 participants