Skip to content

Commit 0f5ec6b

Browse files
authored
Revert "feat: deployment flags (#4426)"
This reverts commit b1faaef.
1 parent 6bc0390 commit 0f5ec6b

File tree

11 files changed

+285
-950
lines changed

11 files changed

+285
-950
lines changed

cli/deployment/flags.go

Lines changed: 0 additions & 455 deletions
This file was deleted.

cli/root.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/coder/coder/cli/cliflag"
2323
"github.com/coder/coder/cli/cliui"
2424
"github.com/coder/coder/cli/config"
25-
"github.com/coder/coder/cli/deployment"
2625
"github.com/coder/coder/coderd"
2726
"github.com/coder/coder/codersdk"
2827
)
@@ -99,9 +98,7 @@ func Core() []*cobra.Command {
9998
}
10099

101100
func AGPL() []*cobra.Command {
102-
df := deployment.Flags()
103-
all := append(Core(), Server(df, func(_ context.Context, o *coderd.Options) (*coderd.API, error) {
104-
o.DeploymentFlags = &df
101+
all := append(Core(), Server(func(_ context.Context, o *coderd.Options) (*coderd.API, error) {
105102
return coderd.New(o), nil
106103
}))
107104
return all

cli/server.go

Lines changed: 260 additions & 137 deletions
Large diffs are not rendered by default.

coderd/coderd.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ type Options struct {
8282
MetricsCacheRefreshInterval time.Duration
8383
AgentStatsRefreshInterval time.Duration
8484
Experimental bool
85-
DeploymentFlags *codersdk.DeploymentFlags
8685
}
8786

8887
// New constructs a Coder API handler.
@@ -260,10 +259,6 @@ func New(options *Options) *API {
260259
})
261260
})
262261
})
263-
r.Route("/flags", func(r chi.Router) {
264-
r.Use(apiKeyMiddleware)
265-
r.Get("/deployment", api.deploymentFlags)
266-
})
267262
r.Route("/audit", func(r chi.Router) {
268263
r.Use(
269264
apiKeyMiddleware,

coderd/coderdtest/coderdtest.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ type Options struct {
8383
IncludeProvisionerDaemon bool
8484
MetricsCacheRefreshInterval time.Duration
8585
AgentStatsRefreshInterval time.Duration
86-
DeploymentFlags *codersdk.DeploymentFlags
8786
}
8887

8988
// New constructs a codersdk client connected to an in-memory API instance.
@@ -238,7 +237,6 @@ func NewOptions(t *testing.T, options *Options) (*httptest.Server, context.Cance
238237
AutoImportTemplates: options.AutoImportTemplates,
239238
MetricsCacheRefreshInterval: options.MetricsCacheRefreshInterval,
240239
AgentStatsRefreshInterval: options.AgentStatsRefreshInterval,
241-
DeploymentFlags: options.DeploymentFlags,
242240
}
243241
}
244242

coderd/flags.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

coderd/flags_test.go

Lines changed: 0 additions & 47 deletions
This file was deleted.

coderd/rbac/object.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,6 @@ var (
133133
ResourceLicense = Object{
134134
Type: "license",
135135
}
136-
137-
// ResourceDeploymentFlags
138-
ResourceDeploymentFlags = Object{
139-
Type: "deployment_flags",
140-
}
141136
)
142137

143138
// Object is used to create objects for authz checks when you have none in

codersdk/flags.go

Lines changed: 0 additions & 136 deletions
This file was deleted.

enterprise/cli/server.go

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,44 @@ import (
55

66
"github.com/spf13/cobra"
77

8+
"github.com/coder/coder/cli/cliflag"
89
"github.com/coder/coder/cli/cliui"
9-
"github.com/coder/coder/cli/deployment"
1010
"github.com/coder/coder/enterprise/coderd"
1111

1212
agpl "github.com/coder/coder/cli"
1313
agplcoderd "github.com/coder/coder/coderd"
1414
)
1515

1616
func server() *cobra.Command {
17-
dflags := deployment.Flags()
18-
cmd := agpl.Server(dflags, func(ctx context.Context, options *agplcoderd.Options) (*agplcoderd.API, error) {
19-
options.DeploymentFlags = &dflags
20-
o := &coderd.Options{
21-
AuditLogging: dflags.AuditLogging.Value,
22-
BrowserOnly: dflags.BrowserOnly.Value,
23-
SCIMAPIKey: []byte(dflags.SCIMAuthHeader.Value),
24-
UserWorkspaceQuota: dflags.UserWorkspaceQuota.Value,
17+
var (
18+
auditLogging bool
19+
browserOnly bool
20+
scimAuthHeader string
21+
userWorkspaceQuota int
22+
)
23+
cmd := agpl.Server(func(ctx context.Context, options *agplcoderd.Options) (*agplcoderd.API, error) {
24+
api, err := coderd.New(ctx, &coderd.Options{
25+
AuditLogging: auditLogging,
26+
BrowserOnly: browserOnly,
27+
SCIMAPIKey: []byte(scimAuthHeader),
28+
UserWorkspaceQuota: userWorkspaceQuota,
2529
Options: options,
26-
}
27-
api, err := coderd.New(ctx, o)
30+
})
2831
if err != nil {
2932
return nil, err
3033
}
3134
return api.AGPL, nil
3235
})
33-
34-
// append enterprise description to flags
35-
enterpriseOnly := cliui.Styles.Keyword.Render(" This is an Enterprise feature. Contact sales@coder.com for licensing")
36-
dflags.AuditLogging.Description += enterpriseOnly
37-
dflags.BrowserOnly.Description += enterpriseOnly
38-
dflags.SCIMAuthHeader.Description += enterpriseOnly
39-
dflags.UserWorkspaceQuota.Description += enterpriseOnly
40-
41-
deployment.BoolFlag(cmd.Flags(), &dflags.AuditLogging)
42-
deployment.BoolFlag(cmd.Flags(), &dflags.BrowserOnly)
43-
deployment.StringFlag(cmd.Flags(), &dflags.SCIMAuthHeader)
44-
deployment.IntFlag(cmd.Flags(), &dflags.UserWorkspaceQuota)
36+
enterpriseOnly := cliui.Styles.Keyword.Render("This is an Enterprise feature. Contact sales@coder.com for licensing")
37+
38+
cliflag.BoolVarP(cmd.Flags(), &auditLogging, "audit-logging", "", "CODER_AUDIT_LOGGING", true,
39+
"Specifies whether audit logging is enabled. "+enterpriseOnly)
40+
cliflag.BoolVarP(cmd.Flags(), &browserOnly, "browser-only", "", "CODER_BROWSER_ONLY", false,
41+
"Whether Coder only allows connections to workspaces via the browser. "+enterpriseOnly)
42+
cliflag.StringVarP(cmd.Flags(), &scimAuthHeader, "scim-auth-header", "", "CODER_SCIM_API_KEY", "",
43+
"Enables SCIM and sets the authentication header for the built-in SCIM server. New users are automatically created with OIDC authentication. "+enterpriseOnly)
44+
cliflag.IntVarP(cmd.Flags(), &userWorkspaceQuota, "user-workspace-quota", "", "CODER_USER_WORKSPACE_QUOTA", 0,
45+
"A positive number applies a limit on how many workspaces each user can create. "+enterpriseOnly)
4546

4647
return cmd
4748
}

0 commit comments

Comments
 (0)