Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#594 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@aryarathoree ci sta già lavorando.

Dal 27/10/2026.

  • #599 di @aryarathoree — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli

Direzione di ricerca

Inizia leggendo login.go intorno alle righe 113-124, dove il comando chiama config.DefaultLocalConfigPath() invece di usare globalClientOpts.ConfigPath. Confrontalo con cmd.go intorno alla riga 63 e con logout, context, start, stop e import, che rispettano già il flag globale. La correzione consiste nel fare in modo che login legga e scriva tramite il percorso di configurazione fornito; fatto significa che microcks login http://localhost:8080 --config ./test-config.yaml aggiorna quel file e lascia intatta la configurazione predefinita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?
  1. Specify a path for an isolated custom configuration file (e.g., ./test-config.yaml).

  2. Run the login command with the custom configuration file:

    microcks login http://localhost:8080 --config ./test-config.yaml
    
  3. Check ./test-config.yaml and observe that the file was not created or modified.

  4. Check ~/.config/microcks/config and 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.

Lingua principale
Go
Stelle
59
Fork
74
Merge medio
5g 17h
PR unite (30g)
22

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microcks/microcks-cli

Tutte le issue di microcks/microcks-cli

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.