bug: microcks login ignores the --config flag and always modifies default config
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Anfängerfreundlichkeit
- 88/100
Rechercherichtung
Beginne mit dem Lesen von login.go im Bereich der Zeilen 113-124, wo der Befehl config.DefaultLocalConfigPath() aufruft, statt globalClientOpts.ConfigPath zu verwenden. Vergleiche das mit cmd.go im Bereich von Zeile 63 sowie mit logout, context, start, stop und import, die das globale Flag bereits berücksichtigen. Die Korrektur besteht darin, login über den übergebenen Konfigurationspfad lesen und schreiben zu lassen; erledigt bedeutet, dass microcks login http://localhost:8080 --config ./test-config.yaml diese Datei aktualisiert und die Standardkonfiguration unverändert lässt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Go
- Sterne
- 59
- Forks
- 74
- Ø Merge
- 4 T. 8 Std.
- Gemergte PRs (30 T.)
- 23
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microcks/microcks-cli
-
bug: microcks test get swallows test failure details and operation results in text output modeOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
microcks/microcks-cli#608 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
microcks/microcks-cli#606 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
microcks/microcks-cli#601 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
microcks/microcks-cli#598 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Wrong link to test resultsEvtl. vergeben @SajanBisht hat das vor 4 Tagen übernommen. Offencomponent/cli keep-open kind/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
microcks/microcks-cli#589 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in microcks/microcks-cli
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
YoanWai/agent-manager#948 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area: platform priority: normal
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
margince/margince#9851 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Headerless responses block while skipping duplicate status linesEvtl. vergeben @mynhe hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
projectdiscovery/rawhttp#554 ·
-
type:chore
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
nightgauge/nightgauge#2793 ·
Maintainer antworten meist innerhalb von 1 Tag
-
stage-fail
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
siyuan-note/bazaar#2447 ·
Maintainer antworten meist innerhalb von 1 Tag