Skip to content

app env get/list: avoid extra SSH round-trip from proxy-mode warning #104

@crowdy

Description

@crowdy

Background

PR #103 introduced `maybeWarnProxyEnvMode` in `cmd/app/env.go:22-27` which is called from every `app env` subcommand (`set`/`get`/`list`/`unset`). Each call issues a remote SSH `cat /opt/conoha//.conoha-mode` just to decide whether to print a one-line warning.

For read-only subcommands this doubles the SSH work — `app env list` already issues one `cat` for the env file itself, and now a second for the marker. Scripts that loop over many apps pay this round-trip per call.

Proposal

Either:

  1. Skip the warning for read-only subcommands (`get`, `list`). The warning is primarily useful when the user is writing values that won't be picked up.
  2. Cache the marker read in `appContext` — `ReadMarker` once in `connectToApp`, stash the result, and have `maybeWarnProxyEnvMode` consume the cached value.

Option 2 benefits every other command that calls `ResolveMode` after `connectToApp` too.

Acceptance

  • `app env list` makes one SSH `cat` round-trip, not two.
  • Warning behavior preserved for `set`/`unset` against proxy-mode apps.

Pointer

  • `cmd/app/env.go:22-27` — `maybeWarnProxyEnvMode`
  • `cmd/app/connect.go` — `appContext` (candidate for cached `Mode` field)

Surfaced by review on PR #103 (item I5).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions