Skip to content

Commit

Permalink
fix: have GetModuleContext use config and secrets from the context in…
Browse files Browse the repository at this point in the history
…stead of creating a new managers using the envar file
  • Loading branch information
safeer committed May 20, 2024
1 parent 9fd04bf commit 339dddf
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions backend/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,18 +657,13 @@ nextModule:
func (s *Service) GetModuleContext(ctx context.Context, req *connect.Request[ftlv1.ModuleContextRequest]) (*connect.Response[ftlv1.ModuleContextResponse], error) {
name := req.Msg.Module

cm, err := cf.NewDefaultConfigurationManagerFromConfig(ctx, cf.ConfigFromEnvironment())
if err != nil {
return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("could not get configs: %w", err))
}
cm := cf.ConfigFromContext(ctx)
sm := cf.SecretsFromContext(ctx)

configs, err := cm.MapForModule(ctx, name)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("could not get configs: %w", err))
}
sm, err := cf.NewDefaultSecretsManagerFromConfig(ctx, cf.ConfigFromEnvironment())
if err != nil {
return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("could not get secrets: %w", err))
}
secrets, err := sm.MapForModule(ctx, name)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("could not get secrets: %w", err))
Expand Down

0 comments on commit 339dddf

Please sign in to comment.