Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fall back to global secrets was not working #1340

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Conversation

matt2e
Copy link
Collaborator

@matt2e matt2e commented Apr 26, 2024

fixes #1339

@matt2e matt2e requested a review from a team as a code owner April 26, 2024 06:30
@matt2e matt2e requested review from deniseli and removed request for a team April 26, 2024 06:30

func (p *InMemoryProvider[R]) Load(ctx context.Context, ref Ref, key *url.URL) ([]byte, error) {
if bytes, found := p.values[ref]; found {
return bytes, nil
}
return nil, fmt.Errorf("key %q not found", ref.Name)
return nil, ErrNotFound
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This specific error must be used

@alecthomas alecthomas mentioned this pull request Apr 26, 2024
gref := ref
gref.Module = optional.None[string]()
key, err = m.resolver.Get(ctx, gref)
ref.Module = optional.None[string]()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If global config/secret is found, we need the ref var to point to it as it is used to access it from the provider.
Previously, resolver would match the global ref, but we would then use the module specific ref with the provider.

@@ -18,13 +18,13 @@ func NewInMemoryProvider[R Role]() *InMemoryProvider[R] {
}

func (p *InMemoryProvider[R]) Role() R { var r R; return r }
func (p *InMemoryProvider[R]) Key() string { return "grpc" }
func (p *InMemoryProvider[R]) Key() string { return "inmemory" }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean up for an old refactor

@matt2e matt2e force-pushed the matt2e/missing-secrets branch from 9b521f2 to 4299e91 Compare April 26, 2024 06:34
@matt2e matt2e merged commit 513f4e8 into main Apr 26, 2024
11 checks passed
@matt2e matt2e deleted the matt2e/missing-secrets branch April 26, 2024 06:38
@deniseli deniseli added the approved Marks an already closed PR as approved label Apr 26, 2024
@deniseli
Copy link
Contributor

Thanks for the comments! Very helpful in understanding the changes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Marks an already closed PR as approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inline global secrets don't seem to work
2 participants