diff --git a/Makefile b/Makefile index 903b7a3..1a06482 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ release: clean deps ## Generate releases for unix systems do \ echo "Building $$os-$$arch"; \ mkdir -p build/webhook-$$os-$$arch/; \ - CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build -o build/webhook-$$os-$$arch/webhook; \ + GOOS=$$os GOARCH=$$arch go build -o build/webhook-$$os-$$arch/webhook; \ tar cz -C build -f build/webhook-$$os-$$arch.tar.gz webhook-$$os-$$arch; \ done \ done diff --git a/README.md b/README.md index 279c494..c9b43a5 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ If you use Mattermost or Slack, you can set up an "Outgoing webhook integration" Everything else is the responsibility of the command's author. ## Not what you're looking for? -| hookdoo | hookdeck | +| hookdoo | hookdeck | | :-: | :-: | -| Scriptable webhook gateway to safely run your custom builds, deploys, and proxy scripts on your servers. | An event gateway to reliably ingest, verify, queue, transform, filter, inspect, monitor, and replay webhooks. | +| Scriptable webhook gateway to safely run your custom builds, deploys, and proxy scripts on your servers. | Inspect, monitor and replay webhooks without the back and forth troubleshooting. | # Getting started diff --git a/docs/Hook-Examples.md b/docs/Hook-Examples.md index 1b01ea4..7d07932 100644 --- a/docs/Hook-Examples.md +++ b/docs/Hook-Examples.md @@ -498,8 +498,7 @@ A reference to the second item in the array would look like this: [ { "id": "sendgrid", - "execute-command": "/root/my-server/deployment.sh", - "command-working-directory": "/root/my-server", + "execute-command": "{{ .Hookecho }}", "trigger-rule": { "match": { "type": "value", diff --git a/images/hookdeck-black.svg b/images/hookdeck-black.svg deleted file mode 100644 index 962b07d..0000000 --- a/images/hookdeck-black.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/images/hookdeck-white.svg b/images/hookdeck-white.svg deleted file mode 100644 index 19afbbf..0000000 --- a/images/hookdeck-white.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/internal/hook/hook.go b/internal/hook/hook.go index 394dd79..6699eeb 100644 --- a/internal/hook/hook.go +++ b/internal/hook/hook.go @@ -13,12 +13,12 @@ import ( "errors" "fmt" "hash" + "io/ioutil" "log" "math" "net" "net/textproto" "os" - "path" "reflect" "regexp" "strconv" @@ -750,18 +750,14 @@ func (h *Hooks) LoadFromFile(path string, asTemplate bool) error { } // parse hook file for hooks - file, e := os.ReadFile(path) + file, e := ioutil.ReadFile(path) if e != nil { return e } if asTemplate { - funcMap := template.FuncMap{ - "cat": cat, - "credential": credential, - "getenv": getenv, - } + funcMap := template.FuncMap{"getenv": getenv} tmpl, err := template.New("hooks").Funcs(funcMap).Parse(string(file)) if err != nil { @@ -960,27 +956,3 @@ func compare(a, b string) bool { func getenv(s string) string { return os.Getenv(s) } - -// cat provides a template function to retrieve content of files -// Similarly to getenv, if no file is found, it returns the empty string -func cat(s string) string { - data, e := os.ReadFile(s) - - if e != nil { - return "" - } - - return strings.TrimSuffix(string(data), "\n") -} - -// credential provides a template function to retreive secrets using systemd's LoadCredential mechanism -func credential(s string) string { - dir := getenv("CREDENTIALS_DIRECTORY") - - // If no credential directory is found, fallback to the env variable - if dir == "" { - return getenv(s) - } - - return cat(path.Join(dir, s)) -}