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
Use proper config
  • Loading branch information
Emyrk committed Apr 18, 2023
commit 7fc66d6b8f5646ff2a385c111ec9b3fef1e7ab8b
21 changes: 3 additions & 18 deletions cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
var (
cfg = new(codersdk.DeploymentValues)
opts = cfg.Options()
// For the develop.sh script, it is helpful to make this key deterministic.
devAppSecurityKey string
)
opts.Add(
// This should be temporary until we support sending this over to the
// proxy via some authenticated api call.
clibase.Option{
Name: "App Security Key (Development Only)",
Description: "Used to override the app security key stored in the database. This should never be used in production.",
Flag: "dangerous-dev-app-security-key",
Default: "",
Value: clibase.StringOf(&devAppSecurityKey),
Annotations: clibase.Annotations{}.Mark("secret", "true"),
Hidden: true,
},
)
serverCmd := &clibase.Cmd{
Use: "server",
Expand Down Expand Up @@ -636,12 +621,12 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
}
}

if devAppSecurityKey != "" {
_, err := workspaceapps.KeyFromString(devAppSecurityKey)
if cfg.Dangerous.DevAppSecurityKey.Value() != "" {
_, err := workspaceapps.KeyFromString(cfg.Dangerous.DevAppSecurityKey.Value())
if err != nil {
return xerrors.Errorf("invalid dev app security key: %w", err)
}
err = tx.UpsertAppSecurityKey(ctx, devAppSecurityKey)
err = tx.UpsertAppSecurityKey(ctx, cfg.Dangerous.DevAppSecurityKey.Value())
if err != nil {
return xerrors.Errorf("Insert dev app security key: %w", err)
}
Expand Down
14 changes: 12 additions & 2 deletions codersdk/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ type LoggingConfig struct {
}

type DangerousConfig struct {
AllowPathAppSharing clibase.Bool `json:"allow_path_app_sharing" typescript:",notnull"`
AllowPathAppSiteOwnerAccess clibase.Bool `json:"allow_path_app_site_owner_access" typescript:",notnull"`
AllowPathAppSharing clibase.Bool `json:"allow_path_app_sharing" typescript:",notnull"`
AllowPathAppSiteOwnerAccess clibase.Bool `json:"allow_path_app_site_owner_access" typescript:",notnull"`
DevAppSecurityKey clibase.String `json:"dev_app_security_key" typescript:",notnull"`
}

const (
Expand Down Expand Up @@ -1182,6 +1183,15 @@ when required by your organization's security policy.`,
Value: &c.Dangerous.AllowPathAppSiteOwnerAccess,
Group: &deploymentGroupDangerous,
},
{
Name: "App Security Key (Development Only)",
Description: "Used to override the app security key stored in the database. This should never be used in production.",
Flag: "dangerous-dev-app-security-key",
Default: "",
Value: &c.Dangerous.DevAppSecurityKey,
Annotations: clibase.Annotations{}.Mark("secret", "true"),
Hidden: true,
},
// Misc. settings
{
Name: "Experiments",
Expand Down