bug: microcks login ignores the --config flag and always modifies default config
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 1/5
- Temps estimé
- Moins d'une heure
- Accessibilité débutants
- 88/100
Piste de recherche
Commence par lire login.go autour des lignes 113-124, où la commande appelle config.DefaultLocalConfigPath() au lieu d'utiliser globalClientOpts.ConfigPath. Compare cela avec cmd.go autour de la ligne 63 et avec logout, context, start, stop et import, qui respectent déjà le flag global. Le correctif consiste à faire en sorte que login lise et écrive via le chemin de configuration fourni ; terminé signifie que microcks login http://localhost:8080 --config ./test-config.yaml met à jour ce fichier et laisse la configuration par défaut intacte.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
When authenticating using the microcks login command, the global --config <path> flag is silently ignored. Even when a custom configuration file path is explicitly provided, microcks login continues to read and write authentication tokens, users, and contexts directly to the default path (~/.config/microcks/config).
This breaks multi-profile setups, CI/CD pipeline isolation (where jobs maintain ephemeral configuration files in dedicated directories), and prevents tests from running in isolated temporary directories.
Expected behavior
Passing --config <path> to microcks login should load and persist configuration, user tokens, server definitions, and contexts into the specified path, matching the behavior of microcks logout, microcks context, microcks start, microcks stop, and microcks import.
Actual behavior
microcks login ignores the provided --config argument and writes the login state to ~/.config/microcks/config. The specified custom configuration file remains untouched.
How to Reproduce?
-
Specify a path for an isolated custom configuration file (e.g.,
./test-config.yaml). -
Run the login command with the custom configuration file:
microcks login http://localhost:8080 --config ./test-config.yaml -
Check
./test-config.yamland observe that the file was not created or modified. -
Check
~/.config/microcks/configand observe that the default configuration file was updated with the context and server information.
Microcks version or git rev
1.0.3 / master (commit 5cef506)
Install method (docker-compose, helm chart, operator, docker-desktop extension,...)
Built from source (go build)
Additional information
Root cause
In cmd.go:63, the persistent --config flag is registered and bound to clientOpts.ConfigPath, then passed to NewLoginCommand(&clientOpts):
command.PersistentFlags().StringVar(
&clientOpts.ConfigPath,
"config",
defaultLocalConfigPath,
"Path to Microcks config",
)
command.AddCommand(NewLoginCommand(&clientOpts))
However, in login.go:113-124, the command hardcodes a call to config.DefaultLocalConfigPath() instead of reading globalClientOpts.ConfigPath:
configFile, err := config.DefaultLocalConfigPath()
if err != nil {
return err
}
localConfig, err := config.ReadLocalConfig(configFile)
// ...
if err := config.WriteLocalConfig(*localConfig, configFile); err != nil {
return err
}
Every other command (start, stop, context, logout, import, and service) correctly uses globalClientOpts.ConfigPath.
Changing the hardcoded path assignment to configFile := globalClientOpts.ConfigPath should restore consistency across the CLI and ensure that microcks login respects the global --config flag.
- Langage dominant
- Go
- Étoiles
- 59
- Forks
- 74
- Merge moyen
- 5 j 17 h
- PR mergées (30 j)
- 22
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microcks/microcks-cli
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
microcks/microcks-cli#601 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
microcks/microcks-cli#598 ·
Les mainteneurs répondent en général sous 1 jour
-
Wrong link to test resultsPeut-être pris @SajanBisht l’a pris il y a 13 jours. Ouvertecomponent/cli keep-open kind/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
microcks/microcks-cli#589 · 4 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Default configuration path falls back to the current directory when the home directory cannot be determinedPeut-être pris @Sarthak-Shreshtha01 l’a pris il y a 16 jours. Ouvertecomponent/cli kind/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
microcks/microcks-cli#583 · 5 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
bug: YAML parse error in config is silently swallowed, login overwrites all other contextsPeut-être pris @Sarthak-Shreshtha01 l’a pris il y a 22 jours. Ouvertecomponent/cli kind/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
microcks/microcks-cli#572 · 6 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de microcks/microcks-cli
Issues similaires
-
feat(gmail): make gmail get --format raw text output the exact message, like drafts get --format rawOuverteclawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
openclaw/gogcli#1276 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement ready-for-agent
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
coder/chat#151 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
hiero-ledger/hiero-sdk-go#1886 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
cloudevents/sdk-go#1346 ·