Skip to content

Commit

Permalink
refactor: replace inmemoryprovider with inlineprovider (#1348)
Browse files Browse the repository at this point in the history
In-memory provider was being used to hold config and secrets in memory,
but inline provider already solved that. Removing to simplify things
  • Loading branch information
matt2e authored Apr 28, 2024
1 parent 4f8a992 commit f8ce99d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 46 deletions.
43 changes: 0 additions & 43 deletions common/configuration/in_memory_provider.go

This file was deleted.

4 changes: 3 additions & 1 deletion go-runtime/modulecontext/from_proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func FromProto(ctx context.Context, response *ftlv1.ModuleContextResponse) (*Mod
}

func newInMemoryConfigManager[R cf.Role](ctx context.Context, config map[string][]byte) (*cf.Manager[R], error) {
provider := cf.NewInMemoryProvider[R]()
provider := cf.InlineProvider[R]{
Inline: true,
}
refs := map[cf.Ref]*url.URL{}
for name, data := range config {
ref := cf.Ref{Name: name}
Expand Down
8 changes: 6 additions & 2 deletions go-runtime/modulecontext/module_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ func TestConfigPriority(t *testing.T) {

moduleName := "test"

cp := cf.NewInMemoryProvider[cf.Configuration]()
cp := cf.InlineProvider[cf.Configuration]{
Inline: true,
}
cr := cf.NewInMemoryResolver[cf.Configuration]()
cm, err := cf.New(ctx, cr, []cf.Provider[cf.Configuration]{cp})
assert.NoError(t, err)
ctx = cf.ContextWithConfig(ctx, cm)

sp := cf.NewInMemoryProvider[cf.Secrets]()
sp := cf.InlineProvider[cf.Secrets]{
Inline: true,
}
sr := cf.NewInMemoryResolver[cf.Secrets]()
sm, err := cf.New(ctx, sr, []cf.Provider[cf.Secrets]{sp})
assert.NoError(t, err)
Expand Down

0 comments on commit f8ce99d

Please sign in to comment.