Skip to content

Commit

Permalink
fix(cli): resolve proxy options with suboptions
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbreuninger committed Mar 15, 2024
1 parent b62a1b3 commit 9a76b27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/client/clientimplementation/proxy_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (s *proxyClient) RefreshOptions(ctx context.Context, userOptionsRaw []strin
return perrors.Wrap(err, "parse options")
}

workspace, err := options.ResolveAndSaveOptionsWorkspace(ctx, s.devPodConfig, s.config, s.workspace, userOptions, s.log)
workspace, err := options.ResolveAndSaveOptionsProxy(ctx, s.devPodConfig, s.config, s.workspace, userOptions, s.log)
if err != nil {
return err
}
Expand Down
15 changes: 14 additions & 1 deletion pkg/options/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func ResolveAndSaveOptionsWorkspace(
originalWorkspace *provider2.Workspace,
userOptions map[string]string,
log log.Logger,
options ...resolver.Option,
) (*provider2.Workspace, error) {
// reload config
workspace, err := provider2.LoadWorkspaceConfig(originalWorkspace.Context, originalWorkspace.ID)
Expand All @@ -101,13 +102,14 @@ func ResolveAndSaveOptionsWorkspace(
if err != nil {
return nil, err
}
options = append(options, resolver.WithResolveLocal())

// resolve options
resolvedOptions, _, err := resolver.New(
userOptions,
provider2.Merge(provider2.ToOptionsWorkspace(workspace), binaryPaths),
log,
resolver.WithResolveLocal(),
options...,
).Resolve(
ctx,
devConfig.DynamicProviderOptionDefinitions(provider.Name),
Expand Down Expand Up @@ -136,6 +138,17 @@ func ResolveAndSaveOptionsWorkspace(
return workspace, nil
}

func ResolveAndSaveOptionsProxy(
ctx context.Context,
devConfig *config.Config,
provider *provider2.ProviderConfig,
originalWorkspace *provider2.Workspace,
userOptions map[string]string,
log log.Logger,
) (*provider2.Workspace, error) {
return ResolveAndSaveOptionsWorkspace(ctx, devConfig, provider, originalWorkspace, userOptions, log, resolver.WithResolveSubOptions())
}

func ResolveOptions(
ctx context.Context,
devConfig *config.Config,
Expand Down

0 comments on commit 9a76b27

Please sign in to comment.