-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
executable file
·120 lines (113 loc) · 2.31 KB
/
config.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
116
117
118
119
120
#!/bin/sh
HOST=apisix
PORT=9180
ADMIN_KEY=edd1c9f034335f136f87ad84b625c8f1
#
# upstreams
#
curl -X PUT -i "http://$HOST:$PORT/apisix/admin/upstreams" -H "X-Api-Key: $ADMIN_KEY" -d '{
"name":"public-app",
"id":"463054059092313163",
"type":"roundrobin",
"pass_host":"pass",
"retries":3,
"retry_timeout":5,
"scheme":"http",
"timeout":{
"connect":5,
"send":10,
"read":10
},
"keepalive_pool":{
"size":320,
"idle_timeout":60,
"requests":1000
},
"nodes":{
"public-app-node1:80":1,
"public-app-node2:80":1
}
}'
curl -X PUT -i "http://$HOST:$PORT/apisix/admin/upstreams" -H "X-Api-Key: $ADMIN_KEY" -d '{
"name":"private-app",
"id":"463054269327606859",
"type":"roundrobin",
"pass_host":"pass",
"retries":3,
"retry_timeout":5,
"scheme":"http",
"timeout":{
"connect":5,
"send":10,
"read":10
},
"keepalive_pool":{
"size":320,
"idle_timeout":60,
"requests":1000
},
"nodes":{
"private-app-node1:80":1,
"private-app-node2:80":1
}
}'
#
# services
#
curl -X PUT -i "http://$HOST:$PORT/apisix/admin/services" -H "X-Api-Key: $ADMIN_KEY" -d '{
"name":"spa",
"id":"463054454279636043",
"plugins":{},
"upstream_id":"463054059092313163"
}'
curl -X PUT -i "http://$HOST:$PORT/apisix/admin/services" -H "X-Api-Key: $ADMIN_KEY" -d '{
"name":"api",
"id":"463056055782343755",
"plugins":{
"openid-connect":{
"client_id":"bank-api",
"client_secret":"kZ9TTjOtalbwWdcJYmu3Hy8CfZQ9xnmD",
"discovery":"http://keycloak:8080/realms/bank/.well-known/openid-configuration",
"introspection_endpoint_auth_method":"client_secret_post",
"realm":"bank",
"redirect_uri":"http://127.0.0.1:9080/api/auth/",
"scope":"openid profile",
"_meta":{"disable":false}
}
},
"upstream_id":"463054269327606859"
}'
#
# routes
#
curl -X PUT -i "http://$HOST:$PORT/apisix/admin/routes" -H "X-Api-Key: $ADMIN_KEY" -d '{
"name":"home",
"id":"463056232899413067",
"desc":"",
"priority":0,
"methods":["GET"],
"plugins":{},
"labels":{},
"uri":"/",
"service_id":"463054454279636043"
}'
curl -X PUT -i "http://$HOST:$PORT/apisix/admin/routes" -H "X-Api-Key: $ADMIN_KEY" -d '{
"name":"api",
"id":"463056390823347275",
"desc":"",
"priority":0,
"methods":[
"GET",
"POST",
"PUT",
"DELETE",
"PATCH"
],
"plugins":{},
"labels":{},
"uris":[
"/api/*",
"/api/auth"
],
"service_id":"463056055782343755"
}'