Skip to content

Commit 7fc66d6

Browse files
committed
Use proper config
1 parent d6c7570 commit 7fc66d6

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

cli/server.go

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
163163
var (
164164
cfg = new(codersdk.DeploymentValues)
165165
opts = cfg.Options()
166-
// For the develop.sh script, it is helpful to make this key deterministic.
167-
devAppSecurityKey string
168-
)
169-
opts.Add(
170-
// This should be temporary until we support sending this over to the
171-
// proxy via some authenticated api call.
172-
clibase.Option{
173-
Name: "App Security Key (Development Only)",
174-
Description: "Used to override the app security key stored in the database. This should never be used in production.",
175-
Flag: "dangerous-dev-app-security-key",
176-
Default: "",
177-
Value: clibase.StringOf(&devAppSecurityKey),
178-
Annotations: clibase.Annotations{}.Mark("secret", "true"),
179-
Hidden: true,
180-
},
181166
)
182167
serverCmd := &clibase.Cmd{
183168
Use: "server",
@@ -636,12 +621,12 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
636621
}
637622
}
638623

639-
if devAppSecurityKey != "" {
640-
_, err := workspaceapps.KeyFromString(devAppSecurityKey)
624+
if cfg.Dangerous.DevAppSecurityKey.Value() != "" {
625+
_, err := workspaceapps.KeyFromString(cfg.Dangerous.DevAppSecurityKey.Value())
641626
if err != nil {
642627
return xerrors.Errorf("invalid dev app security key: %w", err)
643628
}
644-
err = tx.UpsertAppSecurityKey(ctx, devAppSecurityKey)
629+
err = tx.UpsertAppSecurityKey(ctx, cfg.Dangerous.DevAppSecurityKey.Value())
645630
if err != nil {
646631
return xerrors.Errorf("Insert dev app security key: %w", err)
647632
}

codersdk/deployment.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,9 @@ type LoggingConfig struct {
328328
}
329329

330330
type DangerousConfig struct {
331-
AllowPathAppSharing clibase.Bool `json:"allow_path_app_sharing" typescript:",notnull"`
332-
AllowPathAppSiteOwnerAccess clibase.Bool `json:"allow_path_app_site_owner_access" typescript:",notnull"`
331+
AllowPathAppSharing clibase.Bool `json:"allow_path_app_sharing" typescript:",notnull"`
332+
AllowPathAppSiteOwnerAccess clibase.Bool `json:"allow_path_app_site_owner_access" typescript:",notnull"`
333+
DevAppSecurityKey clibase.String `json:"dev_app_security_key" typescript:",notnull"`
333334
}
334335

335336
const (
@@ -1182,6 +1183,15 @@ when required by your organization's security policy.`,
11821183
Value: &c.Dangerous.AllowPathAppSiteOwnerAccess,
11831184
Group: &deploymentGroupDangerous,
11841185
},
1186+
{
1187+
Name: "App Security Key (Development Only)",
1188+
Description: "Used to override the app security key stored in the database. This should never be used in production.",
1189+
Flag: "dangerous-dev-app-security-key",
1190+
Default: "",
1191+
Value: &c.Dangerous.DevAppSecurityKey,
1192+
Annotations: clibase.Annotations{}.Mark("secret", "true"),
1193+
Hidden: true,
1194+
},
11851195
// Misc. settings
11861196
{
11871197
Name: "Experiments",

0 commit comments

Comments
 (0)