-
Notifications
You must be signed in to change notification settings - Fork 3
/
entrypoint.sh
executable file
·58 lines (44 loc) · 1.26 KB
/
entrypoint.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
#!/bin/sh
##################################################################
# Command: #
# run -e PLAYGROUND_PAT=... "command" "environment" "configFile" #
##################################################################
# get args
debug=$1
cmd=$2
environment=$3
configFile=$4
## cmd cannot be empty
if [[ -z "$cmd" ]]; then
echo "cmd can not be empty"
exit 1
fi
# if there is a configFile...
if [[ -n "$configFile" ]]; then
echo "using custom installation from $configFile "
mkdir -p /napptive
cp ${configFile} /napptive/.playground.yaml
if [[ $? -ne 0 ]]; then
exit 1
fi
export PLAYGROUND_CONFIG=/napptive/
echo "PLAYGROUND_CONFIG env added: $PLAYGROUND_CONFIG"
fi
# add app dir to the path to allow execute the playground command
export PATH=$PATH:/app/
# Step 1. Login in to the platform
# Login into the platform (with pat flag)
/app/playground login --pat --debug=$debug
if [[ $? -ne 0 ]]; then
exit 1
fi
# if environment!= "" -> use it!
if [[ -n "$environment" ]]; then
/app/playground env use ${environment} --debug=$debug
if [[ $? -ne 0 ]]; then
exit 1
fi
fi
# execute the command
/app/playground ${cmd} --debug=$debug
exit $?