Skip to content

chore: Add workspace proxy enterprise cli commands #7176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor changes
  • Loading branch information
Emyrk committed Apr 18, 2023
commit 5ac70d5dbd8fdd90643d01e83c55704bc40b85a0
3 changes: 2 additions & 1 deletion codersdk/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ const (
flagExternalProxies = "external_workspace_proxies"
)

func IsExternalProxies(opt clibase.Option) bool {
// IsWorkspaceProxies returns true if the cli option is used by workspace proxies.
func IsWorkspaceProxies(opt clibase.Option) bool {
// If it is a bool, use the bool value.
b, _ := strconv.ParseBool(opt.Annotations[flagExternalProxies])
return b
Expand Down
4 changes: 2 additions & 2 deletions enterprise/cli/proxyserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (r *RootCmd) proxyServer() *clibase.Cmd {
var (
cfg = new(codersdk.DeploymentValues)
// Filter options for only relevant ones.
opts = cfg.Options().Filter(codersdk.IsExternalProxies)
opts = cfg.Options().Filter(codersdk.IsWorkspaceProxies)

externalProxyOptionGroup = clibase.Group{
Name: "External Workspace Proxy",
Expand Down Expand Up @@ -84,7 +84,7 @@ func (r *RootCmd) proxyServer() *clibase.Cmd {
Hidden: false,
},

// TODO: Make sure this is kept secret. Idk if a flag is the best option
// TODO: This will eventually be pulled over an authenticated api endpoint.
clibase.Option{
Name: "App Security Key",
Description: "App security key used for decrypting/verifying app tokens sent from coderd.",
Expand Down
2 changes: 1 addition & 1 deletion enterprise/cli/workspaceproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (r *RootCmd) workspaceProxy() *clibase.Cmd {
func (r *RootCmd) deleteProxy() *clibase.Cmd {
client := new(codersdk.Client)
cmd := &clibase.Cmd{
Use: "delete",
Use: "delete <name|id>",
Short: "Delete a workspace proxy",
Middleware: clibase.Chain(
clibase.RequireNArgs(1),
Expand Down
7 changes: 4 additions & 3 deletions enterprise/wsproxy/wsproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ func (s *Server) DialWorkspaceAgent(id uuid.UUID) (*codersdk.WorkspaceAgentConn,

func (s *Server) buildInfo(rw http.ResponseWriter, r *http.Request) {
httpapi.Write(r.Context(), rw, http.StatusOK, codersdk.BuildInfoResponse{
ExternalURL: buildinfo.ExternalURL(),
Version: buildinfo.Version(),
DashboardURL: s.DashboardURL.String(),
ExternalURL: buildinfo.ExternalURL(),
Version: buildinfo.Version(),
DashboardURL: s.DashboardURL.String(),
WorkspaceProxy: true,
})
}

Expand Down
1 change: 1 addition & 0 deletions site/src/api/typesGenerated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ export interface DERPServerConfig {
export interface DangerousConfig {
readonly allow_path_app_sharing: boolean
readonly allow_path_app_site_owner_access: boolean
readonly dev_app_security_key: string
}

// From codersdk/deployment.go
Expand Down