From 0bd888fc291eebcf602a0782054f45819a1843a9 Mon Sep 17 00:00:00 2001 From: Imogen Kraak Date: Tue, 15 Oct 2024 10:49:13 +0100 Subject: [PATCH] Address PR comments --- Makefile | 2 +- bundles/simple/manifest.json | 10 +++++----- bundles/simple/plugin-2.go | 10 ---------- bundles/simple/{plugin.go => plugin_1.go} | 0 bundles/simple/plugin_2.go | 10 ++++++++++ 5 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 bundles/simple/plugin-2.go rename bundles/simple/{plugin.go => plugin_1.go} (100%) create mode 100644 bundles/simple/plugin_2.go diff --git a/Makefile b/Makefile index edd5c3ba..4b89601f 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ stop: ## Stop runs development environment with mserv and mongo in docker compos # Builds multiple Go plugins and moves them into local Tyk instance. plugins: -> @for plugin in plugin.go plugin-2.go; do \ +> @for plugin in plugin_1.go plugin_2.go; do \ > docker compose run --rm tyk-plugin-compiler $$plugin _$$(date +%s); \ > done .PHONY: plugins diff --git a/bundles/simple/manifest.json b/bundles/simple/manifest.json index 4924131f..9ad5a9ba 100644 --- a/bundles/simple/manifest.json +++ b/bundles/simple/manifest.json @@ -1,19 +1,19 @@ { "file_list": [ - "plugin_v5.2.2_linux_amd64.so", - "plugin-2_v5.2.2_linux_amd64.so" + "plugin_1_v5.2.2_linux_amd64.so", + "plugin_2_v5.2.2_linux_amd64.so" ], "custom_middleware": { "pre": [ { "name": "AddFooBarHeader", - "path": "plugin_v5.2.2_linux_amd64.so", + "path": "plugin_1_v5.2.2_linux_amd64.so", "require_session": false, "raw_body_only": false }, { - "name": "AddFooBarHeader2", - "path": "plugin-2_v5.2.2_linux_amd64.so", + "name": "AddHelloWorldHeader", + "path": "plugin_2_v5.2.2_linux_amd64.so", "require_session": false, "raw_body_only": false } diff --git a/bundles/simple/plugin-2.go b/bundles/simple/plugin-2.go deleted file mode 100644 index 64761fe6..00000000 --- a/bundles/simple/plugin-2.go +++ /dev/null @@ -1,10 +0,0 @@ -package main - -import ( - "net/http" -) - -// AddFooBarHeader2 adds custom "Foo: Bar" header to the request -func AddFooBarHeader2(_ http.ResponseWriter, r *http.Request) { - r.Header.Add("Foo", "Bar") -} diff --git a/bundles/simple/plugin.go b/bundles/simple/plugin_1.go similarity index 100% rename from bundles/simple/plugin.go rename to bundles/simple/plugin_1.go diff --git a/bundles/simple/plugin_2.go b/bundles/simple/plugin_2.go new file mode 100644 index 00000000..9dad7a43 --- /dev/null +++ b/bundles/simple/plugin_2.go @@ -0,0 +1,10 @@ +package main + +import ( + "net/http" +) + +// AddHelloWorldHeader adds custom "Hello: World" header to the request +func AddHelloWorldHeader(_ http.ResponseWriter, r *http.Request) { + r.Header.Add("Hello", "World") +}