1
0
Fork 0
mirror of https://github.com/Luzifer/korvike.git synced 2024-12-20 11:11:19 +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 $ echo '{{ tplexec (file "my.tpl") }}' | korvike
bar 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] }}` - `{{ vault <path> <key> [default value] }}`
Read a key from Vault using `VAULT_ADDR` and `VAULT_TOKEN` environment variables (or `~/.vault-token` file) for authentication. Read a key from Vault using `VAULT_ADDR` and `VAULT_TOKEN` environment variables (or `~/.vault-token` file) for authentication.
```console ```console

View file

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