-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathlib.sh
More file actions
22 lines (16 loc) · 712 Bytes
/
lib.sh
File metadata and controls
22 lines (16 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
# shellcheck disable=SC2034
# To be sourced within the generate-* scripts in this directory.
# We need to deal with cf version 7 and 8 JSON differences in service
# key data; the latter starts with a single `credentials` property.
set -o errexit
declare uaa_url clientid clientsecret service_key_file
service_key_file="${1:?Specify name of file containing service key data}"
shift
uaa_url="$(jq -r '(.credentials//.).uaa.url' "${service_key_file}")"
clientid="$(jq -r '(.credentials//.).uaa.clientid' "${service_key_file}")"
clientsecret="$(jq -r '(.credentials//.).uaa.clientsecret' "${service_key_file}")"
if [[ -z $uaa_url ]]; then
echo "No service key data available"
exit 1
fi