Skip to content

docs: log in once to a self-hosted k8s-proxy - #983

Merged
slayerjain merged 6 commits into
mainfrom
docs/selfhosted-saved-login-next
Nov 20, 2026
Merged

slayerjain merged 6 commits into
mainfrom
docs/selfhosted-saved-login-next

Conversation

@slayerjain

Copy link
Copy Markdown
Member

What

Self-hosted users no longer have to export KEPLOY_API_KEY and
KEPLOY_K8S_PROXY_URL in every shell. The cloud replay page's k8s-proxy
auth section gains "Log in once on your own machine":

  • keploy login --k8s-proxy-url https://<ingress> --api-key <key> checks
    the key at the proxy and, only if the proxy accepts it, saves the key and
    the URL in ~/.keploy/cred.yaml (on Windows, .keploy\cred.yaml in the
    home folder: %HOMEDRIVE%%HOMEPATH%, else %USERPROFILE%), readable by
    the user only (0600; an owner-only ACL on Windows).
    A refused login saves nothing.
  • Later commands find both there. A saved login turns k8s-proxy-auth mode
    on; --k8s-proxy-auth=false leaves it off for one run, and keploy logout
    removes the saved login.
  • keploy login --show prints the key (last 4 characters) and the URL,
    where each comes from, and whether k8s-proxy-auth mode is on and why, with
    no network call.
  • A command run in a terminal with both variables exported offers once,
    after it has finished successfully, to save them, remembered per key and
    URL. The question waits 10 seconds at most and never changes the exit
    code. A run in CI (any CI variable, even with a terminal), without a
    terminal, or in the background never asks and never saves; one moved to
    the background while the question waits (Ctrl-Z, then bg) stops
    waiting at once and saves nothing; and an Enter typed before the
    question does not answer it.
  • Precedence: flag, then environment variable, then keploy.yml, then the
    saved login. CI keeps the environment variables.

The CLI reference lists keploy login --k8s-proxy-url and --show, says
keploy logout removes a saved login, and counts a saved login among what
makes a run self-hosted for the update check.

Checks

  • npx prettier@2.8.8 --check on both changed files, as the prettify
    workflow runs it: clean.
  • build_and_check.yml's commands in Node 22 on a full clone:
    yarn install --frozen-lockfile, the yarn.lock check, yarn build and
    the four verify scripts pass.

The k8s-proxy auth section of the cloud replay page gains "Log in once
on your own machine": `keploy login --k8s-proxy-url <ingress>` checks
the API key at the proxy and saves the key and the URL in an owner-only
~/.keploy/cred.yaml, so later commands need neither KEPLOY_API_KEY nor
KEPLOY_K8S_PROXY_URL. It covers `keploy login --show`, `keploy logout`,
the one-time offer to save variables already exported (asked only in a
terminal), the precedence (flag, environment, keploy.yml, saved login),
and keeps the environment variables for CI.

The CLI reference lists the login's --k8s-proxy-url and --show flags,
says logout removes a saved login, and counts a saved login among what
makes a run self-hosted for the update check.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
keploy login --show now also prints whether k8s-proxy-auth mode is on
and what turned it on or off: the --k8s-proxy-auth flag, the
KEPLOY_K8S_PROXY_AUTH variable, a k8s-proxy URL (with keploy logout as
the way back for a saved one), or keploy.yml's cloud.k8sProxyAuth.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
A command run in a terminal with KEPLOY_API_KEY and KEPLOY_K8S_PROXY_URL
exported now offers to save them only once it has finished successfully.
The question waits 10 seconds at most, with no answer saving nothing, and
never changes the exit code. A run in CI never asks, even when the runner
gives it a terminal.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
On Windows the CLI keeps the login in .keploy under HOMEDRIVE+HOMEPATH,
or USERPROFILE when those are not set. keploy login uses a saved key
without asking, and its key prompt does not show what is typed.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
A run sent to the background of its terminal is never asked, so the
question cannot stop it, and an Enter typed while the command ran does
not answer it. The key sources of keploy login --k8s-proxy-url include a
login already saved.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
A self-hosted run asked to save its login and moved to the background
while the question waits (Ctrl-Z, then bg) stops waiting at once and
saves nothing, as the CLI now does.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
@slayerjain
slayerjain merged commit c3ebd8b into main Nov 20, 2026
6 checks passed
@slayerjain
slayerjain deleted the docs/selfhosted-saved-login-next branch November 20, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant