-
Notifications
You must be signed in to change notification settings - Fork 17
http mock server: Added glob template helper function #165
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
Conversation
README.md
Outdated
@@ -87,6 +87,7 @@ When using [Go templates](https://golang.org/pkg/text/template/) as part of the | |||
- `env KEY`: function that returns the KEY from environment. | |||
- `sum A B`: function that returns the sum of numbers A and B (only for integers). | |||
- `file PATH`: function that returns the contents of the file at PATH. | |||
- `glob PATTERN`: function that returns the names of all files matching PATTERN. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `glob PATTERN`: function that returns the names of all files matching PATTERN. | |
- `glob PATTERN`: function that returns the names of all files matching glob PATTERN (see [filepath.Match](https://pkg.go.dev/path/filepath#Match) for syntax). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in e832836
internal/httpserver/config.go
Outdated
@@ -51,6 +52,7 @@ func (t *tpl) Unpack(in string) error { | |||
"hostname": hostname, | |||
"sum": sum, | |||
"file": file, | |||
"glob": glob, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could write:
"glob": filepath.Glob,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Updated in e832836
💚 Build Succeeded
History
cc @kcreddy |
With
glob
+file
helpers, we can read from multiple files matching a pattern.Closes #161