Skip to content

Commit

Permalink
Merge pull request PGBI#199 from illyaMs/kong-10x-support
Browse files Browse the repository at this point in the history
Add kong 1.0.x support
  • Loading branch information
PGBI authored Mar 17, 2019
2 parents e93365a + 0b1096f commit b61ff08
Show file tree
Hide file tree
Showing 22 changed files with 1,445 additions and 159 deletions.
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ node_js:
- "6"

env:
- KONG_VERSION=0.9 POSTGRES_VERSION=9.4
- KONG_VERSION=0.10 POSTGRES_VERSION=9.4
- KONG_VERSION=0.11 POSTGRES_VERSION=9.4
- KONG_VERSION=0.12 POSTGRES_VERSION=9.4
- KONG_VERSION=0.13 POSTGRES_VERSION=9.4
- KONG_VERSION=0.14 POSTGRES_VERSION=9.5
- KONG_VERSION=0.9 POSTGRES_VERSION=9.4 MIGRATIONS_VERB=up
- KONG_VERSION=0.10 POSTGRES_VERSION=9.4 MIGRATIONS_VERB=up
- KONG_VERSION=0.11 POSTGRES_VERSION=9.4 MIGRATIONS_VERB=up
- KONG_VERSION=0.12 POSTGRES_VERSION=9.4 MIGRATIONS_VERB=up
- KONG_VERSION=0.13 POSTGRES_VERSION=9.4 MIGRATIONS_VERB=up
- KONG_VERSION=0.14 POSTGRES_VERSION=9.5 MIGRATIONS_VERB=up
- KONG_VERSION=0.15 POSTGRES_VERSION=9.5 MIGRATIONS_VERB=bootstrap
- KONG_VERSION=1.0 POSTGRES_VERSION=9.5 MIGRATIONS_VERB=bootstrap

services:
- docker

before_install:
- docker run -d --name kong-database -e "POSTGRES_USER=kong" -e "POSTGRES_DB=kong" postgres:${POSTGRES_VERSION}-alpine
- sleep 5
- docker run --rm --link kong-database:kong-database -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" kong:$KONG_VERSION kong migrations up
- docker run --rm --link kong-database:kong-database -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" kong:$KONG_VERSION kong migrations $MIGRATIONS_VERB
- docker run -d --name kong --link kong-database:kong-database -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_ADMIN_LISTEN=0.0.0.0:8001" -p 8001:8001 -p8000:8000 kong:$KONG_VERSION
- sleep 5

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ and services such as requests routing, authentication, rate limiting, etc.
| 3.0.x | >= 0.9, <0.12 | >= 6.0.0 |
| 3.1.x, 3.2.x | >= 0.9, <0.13 | >= 6.0.0 |
| 3.3.x, 3.4.x | >= 0.9, <0.14 | >= 6.0.0 |
| 3.5.x | >= 0.9, <0.15 | >= 6.0.0 |
| 3.5.x | >= 0.9, <0.15 | >= 6.0.0 |
| 3.6.x | >= 0.9, <2.0.0 | >= 6.0.0 |

Notes:
* Kong Dashboard 3.3.0 is only partially compatible with Kong 0.13. It does not support the new Service and Route
Expand Down
6 changes: 3 additions & 3 deletions bin/kong-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function start(argv) {
argv.kongRequestOpts.headers['Authorization'] = 'Basic ' + base64;
}

if (argv.apiKey !== '') {
if (argv.apiKey !== '' && typeof argv.apiKey !== 'undefined') {
argv.kongRequestOpts.headers[argv.apiKeyName.toLowerCase()] = argv.apiKey;
}

Expand Down Expand Up @@ -162,8 +162,8 @@ function start(argv) {
terminal.error("This version of Kong dashboard doesn't support Kong v0.9 and lower.");
process.exit(1);
}
if (semver.gte(version, '0.15.0')) {
terminal.error("This version of Kong dashboard doesn't support Kong v0.15 and higher.");
if (semver.gte(version, '2.0.0')) {
terminal.error("This version of Kong dashboard doesn't support Kong v2.0 and higher.");
process.exit(1);
}
terminal.success("Connected to Kong on " + argv.kongUrl + ".");
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ services:
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-database
command: sh -c "kong migrations up && touch migrations_run && sleep 30"
# command: sh -c "kong migrations up && touch migrations_run && sleep 30" # for kong < 0.15
command: sh -c "kong migrations bootstrap && touch migrations_run && sleep 30" # for kong >= 0.15
healthcheck:
test: "if [[ -f migrations_run ]] ; then exit 0; else exit 1; fi"
interval: 10s
Expand Down
Loading

0 comments on commit b61ff08

Please sign in to comment.