1
0
mirror of https://github.com/Luzifer/korvike.git synced 2024-09-19 08:52:57 +00:00

Add urlescape function

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-12-10 17:54:28 +01:00
parent 695b089692
commit 2b2aadc279
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D
2 changed files with 13 additions and 0 deletions

View File

@ -67,6 +67,12 @@
$ echo '{{ tplexec (file "my.tpl") }}' | korvike
bar
```
- `{{ urlescape <input string> }}`
Do an URL escape to use the input string inside an query parameter in an URL
```console
$ echo '{{ urlescape "Hellö Wörld@Golang" }}' | korvike
Hell%C3%B6+W%C3%B6rld%40Golang
```
- `{{ vault <path> <key> [default value] }}`
Read a key from Vault using `VAULT_ADDR` and `VAULT_TOKEN` environment variables (or `~/.vault-token` file) for authentication.
```console

View File

@ -0,0 +1,7 @@
package functions
import "net/url"
func init() {
registerFunction("urlescape", url.QueryEscape)
}