Skip to content

Commit

Permalink
fix: GetModuleContext: use config from context instead of from envar (#…
Browse files Browse the repository at this point in the history
…1534)

Fixes #1352

With this change, the behavior is:
- `ftl dev examples/go`
  - uses `ftl-project.toml` in the gitroot if it exists
- `FTL_CONFIG=ftl-project-inline-a.toml ftl dev examples/go`
  - uses `ftl-project-inline-a.toml`
- `ftl dev examples/go --config=ftl-project-inline-b.toml`
  - uses `ftl-project-inline-b.toml`
- `FTL_CONFIG=ftl-project-inline-a.toml ftl dev examples/go --recreate
--config=ftl-project-inline-b.toml`
  - uses `ftl-project-inline-b.toml`
  • Loading branch information
safeer authored May 20, 2024
1 parent 9fd04bf commit 5a62849
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 5a62849

Please sign in to comment.