forked from GSA/data.gov
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenable-egress
More file actions
executable file
·41 lines (36 loc) · 1.12 KB
/
enable-egress
File metadata and controls
executable file
·41 lines (36 loc) · 1.12 KB
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
#!/bin/bash
set -e
set -o pipefail
help()
{
echo
echo "$0: enables egress proxy for a given app."
echo "Note that this will not set up egress, but rather re-enable egress that has been disabled with disable-egress."
echo "Syntax: $0 <APP>"
echo " <APP> must be a valid cf app in the current space with egress disabled."
#echo "Options:"
#echo " --space <SPACE>: #TODO"
echo
echo "To disable egress for an app, use disable-egress."
echo "This depends on DATAGOV_DIR and CG_DIR environment variables being set."
exit 1
}
app="$1"
space="$2"
if [ -z "$app" ]; then
echo "No app provided."
help
elif [ -z "$space" ]; then
echo "No space provided."
help
else
# cg-egress-proxy needs jq 🤷
if ! command -v jq &> /dev/null; then
apt-get install jq -y
fi
cp "$DATAGOV_DIR/egress/acl/${space}.allow.acl" "$CG_DIR/${app}.allow.acl"
cp "$DATAGOV_DIR/egress/acl/${space}.deny.acl" "$CG_DIR/${app}.deny.acl"
# need to be in CG_DIR for cg-egress-proxy scripts to run correctly
cd "$CG_DIR"
bin/cf-deployproxy -a "$app" -s "$space-egress" -e "proxy_url"
fi