Skip to content

fix: honor --config flag in login command (#594) - #599

Open
aryarathoree wants to merge 1 commit into
microcks:masterfrom
aryarathoree:fix/login-honor-config-flag
Open

aryarathoree wants to merge 1 commit into
microcks:masterfrom
aryarathoree:fix/login-honor-config-flag

Conversation

@aryarathoree

@aryarathoree aryarathoree commented Oct 27, 2026 •

Copy link
Copy Markdown

Problem

When running microcks login, the global --config flag is ignored. In cmd/login.go, the code hardcoded a call to config.DefaultLocalConfigPath() instead of using globalClientOpts.ConfigPath, causing login credentials and contexts to always be read from and written to ~/.config/microcks/config.

Solution

  1. Updated cmd/login.go to use globalClientOpts.ConfigPath, falling back to config.DefaultLocalConfigPath() only when unset.
  2. Added unit tests in cmd/login_test.go verifying:
    • --config creates and populates the specified custom configuration file.
    • Custom context names via --name are preserved in the custom config.
    • Existing contexts/servers in a custom config are preserved across logins.

Fixes #594

The login command bypassed the global --config flag and hardcoded a call to config.DefaultLocalConfigPath(), causing credentials and contexts to always be written to the default ~/.config/microcks/config.

Update cmd/login.go to use globalClientOpts.ConfigPath, falling back to DefaultLocalConfigPath if unset. Add unit tests verifying custom config paths are respected and preserved.

Signed-off-by: Arya Rathore <[email protected]>
@github-actions

Copy link
Copy Markdown

👋 @aryarathoree

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: microcks login ignores the --config flag and always modifies default config

1 participant