Skip to content

Commit 285f2a0

Browse files
committed
test the run against krakend designer
1 parent 7acd634 commit 285f2a0

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ swagger/*
66
!swagger/.gitkeep
77
!swagger/pet-store.json
88
deployment/ingress-aws.yaml
9+
.env
910
.DS_Store

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
.PHONY: build dockerize test
1+
.PHONY: build dockerize test run
22

33
build:
44
rm -rf ./build && \
55
env GOOS=linux GOARCH=amd64 go build -o ./build/openapi2krakend ./pkg
6+
upx -9 ./build/openapi2krakend
67

78
dockerize: build
89
docker buildx build --platform=linux/amd64 -f docker/Dockerfile -t okhuz/openapi2krakend:0.0.6 .
910

1011
test:
11-
go test ./... -v
12+
go test ./... -v
13+
14+
run:
15+
./scripts/run.sh

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ files and convert.
2020
<br>
2121
-encoding: backend encoding for whole endpoints. default is "json".
2222
<br>
23-
-global-timeout: sets global timeout, default is 3000ms
23+
-global-timeout: sets global timeout, default is 3000ms, if there is a `x-timeout` attribute in any of the swagger files
24+
this will be overwritten.
2425

2526
### Usage
2627

@@ -36,6 +37,11 @@ To dockerize
3637
make dockerize
3738
````
3839

40+
To run with sample environment variables
41+
```shell
42+
make run
43+
```
44+
3945
### Deployment to Kubernetes
4046

4147
In deployment/deployment.yaml file you can set environment variables to "https://service-1/api-specification,https://service-2/api-specification"

deployment/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ spec:
2323
value: "true"
2424
- name: LOG_LEVEL
2525
value: "DEBUG"
26+
- name: LOG_PREFIX
27+
value: "[KRAKEND]"
28+
- name: LOG_SYSLOG
29+
value: "true"
2630
- name: ENABLE_CORS
2731
value: "true"
2832
- name: ALLOWED_ORIGINS

pkg/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ func main() {
1818
configuration := converter.Convert(*swaggerDirectory, *encoding, *globalTimeout)
1919

2020
file, _ := json.MarshalIndent(configuration, "", " ")
21-
//emptyLine := []byte("\n")
22-
//file = append(file, emptyLine...)
2321
_ = os.MkdirAll(path.Join(path.Base(""), "output"), 0777)
2422
_ = os.WriteFile("output/krakend.json", file, 0644)
2523
}

scripts/run.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
4+
export ENABLE_LOGGING=true
5+
export LOG_LEVEL=DEBUG
6+
export LOG_PREFIX="[TEST]"
7+
export ALLOWED_ORIGINS=https://tenera.io
8+
export ENABLE_CORS=true
9+
export ALLOWED_METHODS="GET,POST"
10+
11+
go run ./pkg

0 commit comments

Comments
 (0)