Skip to content

Commit bdf08bf

Browse files
committed
Remove deployment config for push notifications in favour of ExperimentWebPush
1 parent 34e1757 commit bdf08bf

File tree

14 files changed

+25
-172
lines changed

14 files changed

+25
-172
lines changed

cli/server.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,8 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
777777
}
778778

779779
// Manage push notifications.
780-
if options.DeploymentValues.Notifications.Push.Enabled {
780+
experiments := coderd.ReadExperiments(options.Logger, options.DeploymentValues.Experiments.Value())
781+
if experiments.Enabled(codersdk.ExperimentWebPush) {
781782
pushNotifier, err := push.New(ctx, &options.Logger, options.Database)
782783
if err != nil {
783784
options.Logger.Error(ctx, "failed to create push notifier", slog.Error(err))
@@ -789,7 +790,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
789790
options.PushNotifier = pushNotifier
790791
} else {
791792
options.PushNotifier = &push.NoopNotifier{
792-
Msg: "Push notifications are not configured.",
793+
Msg: "Push notifications are disabled. Enable the 'web-push' experiment to use this feature.",
793794
}
794795
}
795796

cli/server_regenerate_vapid_keypair.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ func (r *RootCmd) newRegenerateVapidKeypairCommand() *serpent.Command {
2424
regenVapidKeypairPgAuth string
2525
)
2626
regenerateVapidKeypairCommand := &serpent.Command{
27-
Use: "regenerate-vapid-keypair",
28-
Short: "Regenerate the VAPID keypair used for push notifications.",
27+
Use: "regenerate-vapid-keypair",
28+
Short: "Regenerate the VAPID keypair used for push notifications.",
29+
Hidden: true, // Hide this command as it's an experimental feature
2930
Handler: func(inv *serpent.Invocation) error {
3031
var (
3132
ctx, cancel = inv.SignalNotifyContext(inv.Context(), StopSignals...)

cli/testdata/coder_server_--help.golden

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ SUBCOMMANDS:
1212
postgres-builtin-serve Run the built-in PostgreSQL deployment.
1313
postgres-builtin-url Output the connection URL for the built-in
1414
PostgreSQL deployment.
15-
regenerate-vapid-keypair Regenerate the VAPID keypair used for push
16-
notifications.
1715

1816
OPTIONS:
1917
--allow-workspace-renames bool, $CODER_ALLOW_WORKSPACE_RENAMES (default: false)
@@ -479,10 +477,6 @@ NOTIFICATIONS / INBOX OPTIONS:
479477
--notifications-inbox-enabled bool, $CODER_NOTIFICATIONS_INBOX_ENABLED (default: true)
480478
Enable Coder Inbox.
481479

482-
NOTIFICATIONS / PUSH OPTIONS:
483-
--notifications-push-enabled bool, $CODER_NOTIFICATIONS_PUSH_ENABLED (default: false)
484-
Enable push notifications using VAPID.
485-
486480
NOTIFICATIONS / WEBHOOK OPTIONS:
487481
--notifications-webhook-endpoint url, $CODER_NOTIFICATIONS_WEBHOOK_ENDPOINT
488482
The endpoint to which to send webhooks.

cli/testdata/server-config.yaml.golden

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,3 @@ notifications:
681681
# How often to query the database for queued notifications.
682682
# (default: 15s, type: duration)
683683
fetchInterval: 15s
684-
push:
685-
# Enable push notifications using VAPID.
686-
# (default: false, type: bool)
687-
enabled: false

coderd/apidoc/docs.go

Lines changed: 5 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 5 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codersdk/deployment.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -700,12 +700,6 @@ type NotificationsConfig struct {
700700
Webhook NotificationsWebhookConfig `json:"webhook" typescript:",notnull"`
701701
// Inbox settings.
702702
Inbox NotificationsInboxConfig `json:"inbox" typescript:",notnull"`
703-
// Push notification settings.
704-
Push NotificationsPushConfig `json:"push" typescript:",notnull"`
705-
}
706-
707-
type NotificationsPushConfig struct {
708-
Enabled serpent.Bool `json:"enabled" typescript:",notnull"`
709703
}
710704

711705
// Are either of the notification methods enabled?
@@ -1007,11 +1001,6 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
10071001
Parent: &deploymentGroupNotifications,
10081002
YAML: "inbox",
10091003
}
1010-
deploymentGroupNotificationsPush = serpent.Group{
1011-
Name: "Push",
1012-
Parent: &deploymentGroupNotifications,
1013-
YAML: "push",
1014-
}
10151004
)
10161005

10171006
httpAddress := serpent.Option{
@@ -2980,16 +2969,6 @@ Write out the current server config as YAML to stdout.`,
29802969
Hidden: true, // Hidden because most operators should not need to modify this.
29812970
},
29822971
// Push notifications.
2983-
{
2984-
Name: "Notifications: Push: Enabled",
2985-
Description: "Enable push notifications using VAPID.",
2986-
Flag: "notifications-push-enabled",
2987-
Env: "CODER_NOTIFICATIONS_PUSH_ENABLED",
2988-
Value: &c.Notifications.Push.Enabled,
2989-
Default: "false",
2990-
Group: &deploymentGroupNotificationsPush,
2991-
YAML: "enabled",
2992-
},
29932972
}
29942973

29952974
return opts
@@ -3214,6 +3193,7 @@ const (
32143193
ExperimentAutoFillParameters Experiment = "auto-fill-parameters" // This should not be taken out of experiments until we have redesigned the feature.
32153194
ExperimentNotifications Experiment = "notifications" // Sends notifications via SMTP and webhooks following certain events.
32163195
ExperimentWorkspaceUsage Experiment = "workspace-usage" // Enables the new workspace usage tracking.
3196+
ExperimentWebPush Experiment = "web-push" // Enables web push notifications through the browser.
32173197
)
32183198

32193199
// ExperimentsAll should include all experiments that are safe for

docs/manifest.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,11 +1320,6 @@
13201320
"description": "Output the connection URL for the built-in PostgreSQL deployment.",
13211321
"path": "reference/cli/server_postgres-builtin-url.md"
13221322
},
1323-
{
1324-
"title": "server regenerate-vapid-keypair",
1325-
"description": "Regenerate the VAPID keypair used for push notifications.",
1326-
"path": "reference/cli/server_regenerate-vapid-keypair.md"
1327-
},
13281323
{
13291324
"title": "show",
13301325
"description": "Display details of a workspace's resources and agents",

docs/reference/api/general.md

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

Lines changed: 1 addition & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/cli/server.md

Lines changed: 6 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/cli/server_regenerate-vapid-keypair.md

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

0 commit comments

Comments
 (0)