-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup-kong.sh
115 lines (104 loc) · 3.25 KB
/
setup-kong.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
echo -e "Creating service FHIR..."
curl --location -g -s -k --request POST 'http://localhost:8001/services' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "fhir-api",
"url": "http://hapi-fhir-jpaserver-start:8080/fhir"
}'
echo -e "\nCreating FHIR API route..."
curl --location -g -s -k --request POST 'http://localhost:8001/routes' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "fhir-api-route",
"preserve_host" : true,
"service": {
"name": "fhir-api"
},
"paths": ["/fhir-api"]
}'
echo -e "\nEnabling plugin basic auth plugin on FHIR API"
curl --location -g -s -k --request POST 'http://localhost:8001/services/fhir-api/plugins' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "basic-auth",
"protocols": ["http", "https"],
"config": {
"hide_credentials": true
}
}'
echo -e "\nEnabling plugin cors plugin on FHIR API"
curl --location -g -s -k --request POST 'http://localhost:8001/services/fhir-api/plugins' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "cors",
"config": {
"origins": ["*"],
"headers": ["*"],
"exposed_headers": ["*"]
}
}'
echo -e "Creating service Admin..."
curl --location -g -s -k --request POST 'http://localhost:8001/services' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "admin-api",
"url": "http://kong:8001"
}'
echo -e "\nCreating route..."
curl --location -g -s -k --request POST 'http://localhost:8001/routes' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "admin-api-route",
"preserve_host" : true,
"service": {
"name": "admin-api"
},
"paths": ["/admin-api"]
}'
echo -e "\nEnabling plugin basic auth plugin"
curl --location -g -s -k --request POST 'http://localhost:8001/services/admin-api/plugins' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "basic-auth",
"protocols": ["http", "https"],
"config": {
"hide_credentials": true
}
}'
echo -e "\nEnabling plugin cors plugin"
curl --location -g -s -k --request POST 'http://localhost:8001/services/admin-api/plugins' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "cors",
"config": {
"origins": ["*"],
"headers": ["*"],
"exposed_headers": ["*"]
}
}'
echo -e "Creating service FHIR..."
curl --location -g -s -k --request POST 'http://localhost:8001/services' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "fhir-api-key-auth",
"url": "http://hapi-fhir-jpaserver-start:8080/fhir"
}'
echo -e "\nCreating FHIR API route..."
curl --location -g -s -k --request POST 'http://localhost:8001/routes' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "fhir-api-key-auth-route",
"preserve_host" : true,
"service": {
"name": "fhir-api-key-auth"
},
"paths": ["/fhir-api-key-auth"]
}'
echo -e "\nEnabling plugin key auth plugin on FHIR API"
curl --location -g -s -k --request POST 'http://localhost:8001/services/fhir-api-key-auth/plugins' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "key-auth",
"protocols": ["http", "https"]
}'