Description
Context
The following message is displayed when a user has an invalid/expired session:
You are signed out or your session has expired. Please sign in again to continue.
Try logging in using 'coder login <url>'.
These appear to all be hardcoded
(grep snippet)
$ rg 'coder login <url>'
cli/logout.go
71: _, _ = fmt.Fprintf(inv.Stdout, Caret+"You are no longer logged in. You can log in using 'coder login <url>'.\n")
cli/logout_test.go
44: pty.ExpectMatch("You are no longer logged in. You can log in using 'coder login <url>'.")
70: pty.ExpectMatch("You are no longer logged in. You can log in using 'coder login <url>'.")
95: assert.ErrorContains(t, err, "You are not logged in. Try logging in using 'coder login <url>'.")
122: assert.ErrorContains(t, err, "You are not logged in. Try logging in using 'coder login <url>'.")
cli/root.go
68: notLoggedInMessage = "You are not logged in. Try logging in using 'coder login <url>'."
cli/userlist_test.go
67: require.Contains(t, err.Error(), "Try logging in using 'coder login <url>'.")
80: require.Contains(t, err.Error(), "Try logging in using 'coder login <url>'.")
codersdk/client.go
344: helpMessage = "Try logging in using 'coder login <url>'."
coderd/templates_test.go
168: require.Contains(t, err.Error(), "Try logging in using 'coder login <url>'.")
Ask
The Coder CLI should respect the values of $CODER_URL
and $CODER_SSH_CONFIG_BINARY_PATH
when displaying these messages.
Example of desired behaviour
You are signed out or your session has expired. Please sign in again to continue.
Try logging in using '/home/denbeigh/path/to/coder login https://denbeighs.coder.instance.real'.
Context
When Coder is deployed in an organisational setting, it may be wrapped in a way that pre-sets these values.
Using these values in logged-out error messages would mean users can just copy-paste the command into their terminal, without needing to confirm what the URL is, or if the right command/right version of the command is being run.