-
Notifications
You must be signed in to change notification settings - Fork 13
/
valmi
executable file
·62 lines (48 loc) · 1.46 KB
/
valmi
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
58
59
60
61
62
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
if [[ "$#" -lt 1 || "${1-}" =~ ^-*h(elp)?$ ]]; then
echo 'Usage:
./valmi [STAGE] [COMMAND]
./valmi prod/dev [docker-compose args]
./valmi prod/dev --with-jitsu [docker-compose args]
Script to manage valmi-activation services.
'
exit
fi
src_dir="$(cd "$(dirname "$0")"; pwd -P)"
main() {
mode="$1"
echo "Manage valmi-activation services:"
cd $src_dir
echo "Working directory: $PWD"
echo "Setting environment variables from .env file"
source $src_dir/.env
jitsu_enabled=false
cmd_args=${@:2}
if [[ "$#" -gt 1 && "$2" == "--with-jitsu" ]]; then
jitsu_enabled=true
cmd_args=${@:3}
fi
# Check if the arguments are empty or not
if [ -z "$cmd_args" ]
then
# If the arguments are empty, then set the default arguments to "up -d"
cmd_args="up -d"
fi
if [ $jitsu_enabled == true ]
then
echo "Running: ${mode} --with-jitsu ${cmd_args}"
echo "Running: ${mode} ${cmd_args} with jitsu"
docker compose -f docker-compose.yml -f docker-compose.$mode.yml -f docker-compose.jitsu.yml $cmd_args
else
echo "Running: ${mode} ${cmd_args}"
echo "Running: ${mode} ${cmd_args} without jitsu"
docker compose -f docker-compose.yml -f docker-compose.$mode.yml $cmd_args
fi
}
main "$@"