Tool to generate the spec template for kong with support of different plguins. Different plugins at service/route level are needed to setup our service on kong.This can be used to generate a template and playaround with it.
Now you can generate template with plugins at global, service and route level.You take the template and extend it for other routes/services.
- key-auth
- cors
- request-transformer-advanced
- rate-limiting-advanced
- exit-transformer
- pre-function
- acl
- Generate the template with plugins at service,route or global level
- Summarise the kong-spec by loading the existing kong-spec and visualise them
- Kong Spec from JSON to YAML and vice-versa
- Handle plugin priority in visualisation via graphviz
brew tap rag594/tap
brew install knox
knox convert --to-format <yaml or json> --input <input-file>
brew install graphviz
knox visualise --spec <spec-file> --output <output-file>
dot -Tsvg -O <dot-output>
foo@bar:~$ knox generate --help
NAME:
CLI for generating kong-spec template generate - generate kong-spec template
USAGE:
CLI for generating kong-spec template generate [command options] [arguments...]
OPTIONS:
--service-plugins value add service-plugins in comma-separated format. Example --service-plugins key-auth,cors
--route-plugins value add route-plugins in comma-separated format. Example --route-plugins key-auth,cors
--global-plugins value add global-plugins in comma-separated format. Example --global-plugins key-auth,cors
--help, -h show help
foo@bar:~$ knox visualise --help
NAME:
CLI for generating/visualising kong-spec visualise - generate the graphviz
USAGE:
CLI for generating/visualising kong-spec visualise [command options] [arguments...]
OPTIONS:
visualise
--output value provide your output file using --output <file-path>
--spec value load the file using --spec <file-path>
foo@bar:~$ knox convert --help
NAME:
CLI for generating/visualising kong-spec and convert - convert to JSON or YAML
USAGE:
CLI for generating/visualising kong-spec convert [command options] [arguments...]
OPTIONS:
converter
--input value provide your input file using --input <file-path>
--to-format value provide the format using --to-format <yaml or json>
foo@bar:~$ knox generate --service-plugins "key-auth"
_format_version: "3.0"
_info:
defaults: {}
select_tags: []
services:
- name: DefaultService
host: xyz.com
port: 80
protocol: ""
path: /
retries: 0
enabled: true
read_timeout: 60000
connect_timeout: 60000
write_timeout: 60000
plugin:
- config:
key_names:
- apiKey
hide_credentials: true
key_in_header: true
key_in_query: false
key_in_body: false
run_on_preflight: false
enabled: true
name: key-auth
protocols:
- http
- https
routes:
- name: route1
protocols:
- http
- https
methods:
- POST
hosts:
- abc.com
paths:
- /abc
https_redirect_status_code: 426
regex_priority: 0
strip_path: false
path_handling: v0
preserve_host: true
request_buffering: true
response_buffering: true