feat: Support ${file:./path} expansion in spec#418
Merged
kodiakhq[bot] merged 5 commits intomainfrom Nov 21, 2022
Merged
Conversation
disq
reviewed
Nov 21, 2022
specs/spec_reader_test.go
Outdated
| otherstuff: 2 | ||
| `) | ||
| _, err = expandFileConfig(badCfg) | ||
| expectedErr := `open ./testdata/creds2.txt: no such file or directory` |
Member
There was a problem hiding this comment.
Why not use errors.Is and ErrNotExist etc.
Contributor
Author
There was a problem hiding this comment.
yeah that would be better. I basically copy pasted from other tests :)
hermanschaaf
suggested changes
Nov 21, 2022
specs/spec_reader.go
Outdated
| Destinations map[string]*Destination | ||
| } | ||
|
|
||
| var fileRegex = regexp.MustCompile(`\$\{file:(.+)\}`) |
Contributor
There was a problem hiding this comment.
Suggested change
| var fileRegex = regexp.MustCompile(`\$\{file:(.+)\}`) | |
| var fileRegex = regexp.MustCompile(`\$\{file:([^}]+)\}`) |
I think this regex should also handle the case where multiple variable replacements occur in the same line.
E.g. before:
${file:abc}-${file:def}
would greedily match abc}-${file:def as the filename, instead of two separate matches abc and def. (Assuming this is a valid)
We may want to add a test case where two variable replacements happen as well (maybe one file replacement and one normal replacement)
Member
There was a problem hiding this comment.
Why not do
var fileRegex = regexp.MustCompile(`\$\{file:(.+?)\}`)for an ungreedy match?
hermanschaaf
approved these changes
Nov 21, 2022
disq
approved these changes
Nov 21, 2022
kodiakhq bot
pushed a commit
that referenced
this pull request
Nov 21, 2022
🤖 I have created a release *beep* *boop* --- ## [1.6.0](v1.5.3...v1.6.0) (2022-11-21) ### Features * Add option to plugin doc command to output tables as JSON ([#347](#347)) ([c1b4240](c1b4240)) * Support ${file:./path} expansion in spec ([#418](#418)) ([58d7c44](58d7c44)) ### Bug Fixes * Fix Destination testing suite ([#417](#417)) ([4771efa](4771efa)) * Increase GRPC message size limit to 50MiB ([#419](#419)) ([a54c6ea](a54c6ea)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
kodiakhq bot
pushed a commit
to cloudquery/cloudquery
that referenced
this pull request
Nov 21, 2022
Updating docs to reflect cloudquery/plugin-sdk#418
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per user request. we had a similar version of that in v0 but now it is generic and available to all specs and not only to a specific destination.