Skip to content

Commit

Permalink
Rename config helper from config ssh to just config
Browse files Browse the repository at this point in the history
This changes the config helper to use just `tsh config` per
suggestion from @r0mant.
  • Loading branch information
timothyb89 committed Jul 8, 2021
1 parent f78ffdb commit 4a02b15
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
9 changes: 5 additions & 4 deletions docs/pages/server-access/guides/openssh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ connect using the standard OpenSSH client:

```bash
# on the machine where you want to run the ssh client
$ tsh --proxy=root.example.com config ssh
$ tsh --proxy=root.example.com config
```

This will generate an OpenSSH client configuration block for the root cluster
Expand Down Expand Up @@ -286,10 +286,11 @@ ssh -p 4022 user@node3.leaf.example.com
title="Automatic OpenSSH and Multiple Clusters"
>
If you switch between multiple Teleport proxy servers, you'll need to re-run
`tsh config ssh` for each to generate the cluster-specific configuration.
`tsh config` for each to generate the cluster-specific configuration.

Similarly, if [trusted clusters](../../trustedclusters.mdx) are added or removed, be
sure to re-run the above command and replace the previous configuration.
Similarly, if [trusted clusters](../../trustedclusters.mdx) are added or
removed, be sure to re-run the above command and replace the previous
configuration.
</Admonition>

### Manual Setup
Expand Down
4 changes: 2 additions & 2 deletions tool/tsh/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func writeSSHConfig(
return nil
}

// onConfigSSH handles the `tsh config ssh` command
func onConfigSSH(cf *CLIConf) error {
// onConfig handles the `tsh config` command
func onConfig(cf *CLIConf) error {
tc, err := makeClient(cf, true)
if err != nil {
return trace.Wrap(err)
Expand Down
19 changes: 5 additions & 14 deletions tool/tsh/tsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,16 +499,7 @@ func Run(args []string, opts ...cliOption) error {
// MFA subcommands.
mfa := newMFACommand(app)

config := app.Command("config", "Manage application configuration")

// TODO: Consider migrating existing config sub-commands for consistency.
// (Alternatively, use `tsh config` directly to generate ssh config, per
// @r0mant's suggestion.)

// configApp := config.Command("app", "Print app connection information.")
// configDB := config.Command("db", "Print database connection information. Useful when configuring GUI clients.")

configSSH := config.Command("ssh", "Print OpenSSH configuration information.")
config := app.Command("config", "Print OpenSSH configuration details")

// On Windows, hide the "ssh", "join", "play", "scp", and "bench" commands
// because they all use a terminal.
Expand All @@ -519,8 +510,8 @@ func Run(args []string, opts ...cliOption) error {
scp.Hidden()
bench.Hidden()

// Similarly, `config ssh` depends on bash.
configSSH.Hidden()
// Similarly, `config` for ssh depends on bash.
config.Hidden()
}

// parse CLI commands+flags:
Expand Down Expand Up @@ -646,8 +637,8 @@ func Run(args []string, opts ...cliOption) error {
err = onRequestCreate(&cf)
case reqReview.FullCommand():
err = onRequestReview(&cf)
case configSSH.FullCommand():
err = onConfigSSH(&cf)
case config.FullCommand():
err = onConfig(&cf)
default:
// This should only happen when there's a missing switch case above.
err = trace.BadParameter("command %q not configured", command)
Expand Down

0 comments on commit 4a02b15

Please # to comment.