-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1-start.sh
More file actions
executable file
·57 lines (45 loc) · 1.74 KB
/
1-start.sh
File metadata and controls
executable file
·57 lines (45 loc) · 1.74 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
source ./0-config.sh
# Main function
main() {
generate_python_client_library # only needs to run once
start_python_test_client # only needs to run once
./2-run_python_test_app.sh
}
##############################################################################
# You should not need to edit anything below to run the demo.
# But of course, once you have run it successfully, feel free to modify.
##############################################################################
#======================================================
function generate_python_client_library() {
# Generated client directory on host
API_DIR=${PWD}/py_client
pushd $GEN_DIR
./bin/generate_client -e -l python -o $API_DIR
popd
}
#======================================================
function start_python_test_client() {
docker stop py_test # remove existing test client
# Mount point in client container for scripts and starting directory
WORKDIR=/test/
docker run -d --rm \
-e "DEBUG=False" \
--name py_test \
-v ${API_DIR}:${WORKDIR}py_client \
-v ${PWD}/bin/init_python.sh:${WORKDIR}init_python.sh \
-v ${PWD}/bin/python_app.py:${WORKDIR}python_app.py \
-v ${PWD}/policy:${WORKDIR}/policy \
-v "${CONJUR_CERT}:${WORKDIR}conjur-cert.pem" \
-e "CONJUR_APPLIANCE_HOSTNAME=${CONJUR_APPLIANCE_HOSTNAME}" \
-e "CONJUR_ACCOUNT=${CONJUR_ACCOUNT}" \
-e "CONJUR_AUTHN_LOGIN=${CONJUR_AUTHN_LOGIN}" \
-e "CONJUR_AUTHN_API_KEY=${CONJUR_AUTHN_API_KEY}" \
--workdir ${WORKDIR} \
--add-host "${CONJUR_APPLIANCE_HOSTNAME}:${CONJUR_HOST_IP_ADDRESS}" \
python:3 \
bash -c "sleep infinity"
echo "Loading Conjur Python client library..."
docker exec py_test ./init_python.sh
}
main "$@"