Skip to content

cli: add --timeout persistent flag for parity with CQ_TIMEOUT #519

Description

@peteski22

Summary

The CLI operation timeout is configurable only via the CQ_TIMEOUT environment variable — there is no --timeout persistent flag. This is inconsistent with the other core connection settings (--addr, --api-key, --db-path), each of which is exposed as both a persistent flag and an environment variable.

Current behavior

  • cliTimeout() (cli/cmd/cli.go) reads CQ_TIMEOUT (integer seconds), falling back to defaultCLITimeout (30s).
  • InitFlags() registers --addr, --api-key, --db-path, but no timeout flag.

Proposed

  • Register a --timeout persistent flag in InitFlags(), resolving with the usual precedence: flag > env (CQ_TIMEOUT) > default.
  • Have cliTimeout() consider the flag value.
  • Document it in the flag help text (env: CQ_TIMEOUT), matching the existing flags.

Open question

  • Flag type: time.Duration (e.g. --timeout 30s) reads naturally and is Go-idiomatic, but CQ_TIMEOUT is currently integer seconds. Decide whether to keep both as seconds for consistency, or accept a duration on the flag while the env var stays seconds.

Context

Surfaced during review of #516, which fixed the remote HTTP client ignoring CQ_TIMEOUT. The flag gap is orthogonal to that fix and better handled on its own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions