Skip to content

Commit 17b3f1c

Browse files
committed
whoops
1 parent 0c4e54b commit 17b3f1c

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

cli/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ import (
9595
"github.com/coder/coder/v2/coderd/tracing"
9696
"github.com/coder/coder/v2/coderd/unhanger"
9797
"github.com/coder/coder/v2/coderd/updatecheck"
98+
"github.com/coder/coder/v2/coderd/util/ptr"
9899
"github.com/coder/coder/v2/coderd/util/slice"
99100
stringutil "github.com/coder/coder/v2/coderd/util/strings"
100101
"github.com/coder/coder/v2/coderd/workspaceapps/appurl"
@@ -782,7 +783,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
782783
if !strings.HasPrefix(options.AccessURL.String(), "https://") {
783784
options.Logger.Warn(ctx, "access URL is not HTTPS, so web push notifications may not work on some browsers", slog.F("access_url", options.AccessURL.String()))
784785
}
785-
webpusher, err := webpush.New(ctx, options.Logger.Named("webpush"), options.Database, options.AccessURL.String())
786+
webpusher, err := webpush.New(ctx, ptr.Ref(options.Logger.Named("webpush")), options.Database, options.AccessURL.String())
786787
if err != nil {
787788
options.Logger.Error(ctx, "failed to create web push dispatcher", slog.Error(err))
788789
options.Logger.Warn(ctx, "web push notifications will not work until the VAPID keys are regenerated")

coderd/coderdtest/coderdtest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
284284

285285
if options.WebpushDispatcher == nil {
286286
// nolint:gocritic // Gets/sets VAPID keys.
287-
pushNotifier, err := webpush.New(dbauthz.AsNotifier(context.Background()), *options.Logger, options.Database, options.AccessURL.String())
287+
pushNotifier, err := webpush.New(dbauthz.AsNotifier(context.Background()), options.Logger, options.Database, "http://example.com")
288288
if err != nil {
289289
panic(xerrors.Errorf("failed to create web push notifier: %w", err))
290290
}

coderd/webpush/webpush.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type Dispatcher interface {
4141
// for updates inside of a workspace, which we want to be immediate.
4242
//
4343
// See: https://github.com/coder/internal/issues/528
44-
func New(ctx context.Context, log slog.Logger, db database.Store, vapidSub string) (Dispatcher, error) {
44+
func New(ctx context.Context, log *slog.Logger, db database.Store, vapidSub string) (Dispatcher, error) {
4545
keys, err := db.GetWebpushVAPIDKeys(ctx)
4646
if err != nil {
4747
if !errors.Is(err, sql.ErrNoRows) {
@@ -73,7 +73,7 @@ func New(ctx context.Context, log slog.Logger, db database.Store, vapidSub strin
7373

7474
type Webpusher struct {
7575
store database.Store
76-
log slog.Logger
76+
log *slog.Logger
7777
// VAPID allows us to identify the sender of the message.
7878
// This must be a https:// URL or an email address.
7979
// Some push services (such as Apple's) require this to be set.

coderd/webpush/webpush_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ func setupPushTest(ctx context.Context, t *testing.T, handlerFunc func(w http.Re
253253
server := httptest.NewServer(http.HandlerFunc(handlerFunc))
254254
t.Cleanup(server.Close)
255255

256-
manager, err := webpush.New(ctx, logger, db, "http://example.com")
256+
manager, err := webpush.New(ctx, &logger, db, "http://example.com")
257257
require.NoError(t, err, "Failed to create webpush manager")
258258

259259
return manager, db, server.URL

0 commit comments

Comments
 (0)