-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kgo: document KongPluginInstallation (#8034)
Co-authored-by: Patryk Małek <[email protected]> Co-authored-by: lena-larionova <[email protected]>
- Loading branch information
1 parent
12e5925
commit 9ea265b
Showing
5 changed files
with
408 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<!-- Shared between KIC and KGO plugin installation --> | ||
## Create a custom plugin | ||
|
||
{:.note} | ||
> For details about plugin development for {{site.base_gateway}}, see the [Plugin Development](/gateway/{{page.release}}/plugin-development) guide. | ||
1. Create a directory with plugin code. | ||
|
||
{:.note} | ||
> If you already have a real plugin, you can skip this step. | ||
```bash | ||
mkdir myheader | ||
echo 'local MyHeader = {} | ||
MyHeader.PRIORITY = 1000 | ||
MyHeader.VERSION = "1.0.0" | ||
function MyHeader:header_filter(conf) | ||
-- do custom logic here | ||
kong.response.set_header("myheader", conf.header_value) | ||
end | ||
return MyHeader | ||
' > myheader/handler.lua | ||
|
||
echo 'return { | ||
name = "myheader", | ||
fields = { | ||
{ config = { | ||
type = "record", | ||
fields = { | ||
{ header_value = { type = "string", default = "roar", }, }, | ||
}, | ||
}, }, | ||
} | ||
} | ||
' > myheader/schema.lua | ||
``` | ||
|
||
The directory should now look like this: | ||
|
||
```bash | ||
tree myheader | ||
``` | ||
|
||
```bash | ||
myheader | ||
├── handler.lua | ||
└── schema.lua | ||
0 directories, 2 files | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.