feat: add --disable-direct flag to CLI (#8131)

This commit is contained in:
Dean Sheather
2023-06-22 06:22:43 +10:00
committed by GitHub
parent bc739bdfce
commit 24b95e16c4
11 changed files with 90 additions and 16 deletions

View File

@ -49,7 +49,13 @@ func (r *RootCmd) ping() *clibase.Cmd {
logger = slog.Make(sloghuman.Sink(inv.Stdout)).Leveled(slog.LevelDebug)
}
conn, err := client.DialWorkspaceAgent(ctx, workspaceAgent.ID, &codersdk.DialWorkspaceAgentOptions{Logger: logger})
if r.disableDirect {
_, _ = fmt.Fprintln(inv.Stderr, "Direct connections disabled.")
}
conn, err := client.DialWorkspaceAgent(ctx, workspaceAgent.ID, &codersdk.DialWorkspaceAgentOptions{
Logger: logger,
BlockEndpoints: r.disableDirect,
})
if err != nil {
return err
}