-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathservice_config.sh
More file actions
25 lines (23 loc) · 923 Bytes
/
service_config.sh
File metadata and controls
25 lines (23 loc) · 923 Bytes
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
#!/bin/bash
# accept IP from first argument, or default to localhost
IP_ADDRESS=${1:-"localhost"}
SERVICES=('init' 'ctl' 'pm' 'cleanup')
for service in "${SERVICES[@]}"
do
name="name="$service
path="paths=/"$service
service_path="url=http://${IP_ADDRESS}:8090/"$service
route_path="http://localhost:8001/services/"$service"/routes"
plugin_path="http://localhost:8001/services/"$service"/plugins"
echo "Name is, $name"
echo "Path is, $path"
echo "Service path is, $service_path"
echo "Route path is, $route_path"
echo "Plugin path is, $plugin_path"
echo "Creating Service, $service..."
curl -i -X POST --url http://localhost:8001/services/ --data $name --data $service_path
echo "Creating route for $service..."
curl -i -X POST --url $route_path --data $path
echo "Creating apikey-based authentication for $service..."
curl -X POST $plugin_path --data "name=key-auth" --data "config.key_names=apikey"
done