Skip to content

Commit 9874aaf

Browse files
committed
use config.New
1 parent 64bcbe1 commit 9874aaf

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

internal/testutil/databroker.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ import (
2323
// NewInMemoryDataBroker creates a new in-memory databroker.
2424
func NewInMemoryDataBroker(tb testing.TB) databrokerpb.DataBrokerServiceClient {
2525
key := bytes.Repeat([]byte{0x01}, 32)
26-
cfg := &config.Config{
27-
Options: config.NewDefaultOptions(),
28-
}
26+
cfg := config.New(config.NewDefaultOptions())
2927
cfg.Options.SharedKey = base64.StdEncoding.EncodeToString(key)
3028
srv := databroker.NewServer(noop.NewTracerProvider(), cfg)
3129
srv.OnConfigChange(tb.Context(), cfg)

pomerium/ctrl/config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ func TestConfigChangeDetect(t *testing.T) {
1515
cfg := new(ctrl.InMemoryConfigSource)
1616

1717
ctx := context.Background()
18-
def := *config.NewDefaultOptions()
18+
def := config.New(config.NewDefaultOptions())
1919
for _, tc := range []struct {
2020
msg string
2121
expect bool
22-
config.Options
22+
cfg *config.Config
2323
}{
2424
{"initial", true, def},
2525
{"same initial", false, def},
2626
{"same again", false, def},
27-
{"changed", true, config.Options{}},
27+
{"changed", true, config.New(config.NewDefaultOptions())},
2828
} {
29-
assert.Equal(t, tc.expect, cfg.SetConfig(ctx, &config.Config{Options: &tc.Options}), tc.msg)
29+
assert.Equal(t, tc.expect, cfg.SetConfig(ctx, tc.cfg), tc.msg)
3030
}
3131
}

pomerium/validate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ func validate(ctx context.Context, cfg *pb.Config, id string) error {
3838
return err
3939
}
4040

41-
pCfg := &config.Config{Options: options, OutboundPort: "8002"}
41+
pCfg := config.New(options)
42+
pCfg.OutboundPort = "8002"
4243

4344
builder := envoyconfig.New("127.0.0.1:8000",
4445
"127.0.0.1:8001",

0 commit comments

Comments
 (0)