Skip to content

Commit

Permalink
Merge branch 'main' into feat-spv-827-Switch-Contacts-capability-from…
Browse files Browse the repository at this point in the history
…-BRFCTemporaryPike-to-BRFCPike.invite
  • Loading branch information
ac4ch authored Jun 7, 2024
2 parents dd530ef + a53cf1e commit b77de4f
Showing 1 changed file with 41 additions and 6 deletions.
47 changes: 41 additions & 6 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ choice=''
# Constants
default_xpriv_value="xprv9s21ZrQH143K3CbJXirfrtpLvhT3Vgusdo8coBritQ3rcS7Jy7sxWhatuxG5h2y1Cqj8FKmPp69536gmjYRpfga2MJdsGyBsnB12E19CESK"

# Variables
servicesToRun=()
servicesToHideLogs=()
additionalFlags=()
composeFiles=("docker-compose.yml")

function print_debug() {
if [ "$debug" == "true" ]; then
echo -e "${color_debug}$1${color_reset}"
Expand Down Expand Up @@ -191,9 +197,9 @@ function docker_compose_up() {
fi

if [ $compose_plugin == true ]; then
docker compose up $1
docker compose $1 up $2
else
docker-compose up $1
docker-compose $1 up $2
fi
}

Expand All @@ -207,6 +213,28 @@ function prefix_each() {
echo "$result"
}

function parse_compose_additional() {
local argument="$1"

# Check if argument value is provided
if [ -z "$argument" ]; then
echo "Error: Argument for --compose-additional is missing"
exit 1
fi

# Split the argument on ':' to separate file and services
IFS=':' read -r file services <<< "$argument"

# Append file to the list of compose files
composeFiles+=("$file")

# Split services by spaces and append to servicesToRun
IFS=' ' read -r -a serviceArray <<< "$services"
for service in "${serviceArray[@]}"; do
servicesToRun+=("$service")
done
}

# === LOAD FROM CLI ===

while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -261,6 +289,10 @@ while [[ $# -gt 0 ]]; do
background="$2"
shift
;;
-ca|--compose-additional)
parse_compose_additional "$2"
shift
;;
-l|--load)
load_config="true"
# no additional arguments so no `shift` command
Expand Down Expand Up @@ -562,9 +594,6 @@ print_success "File .env.config updated!"
print_debug "$(cat .env.config)"

# === RUN WHAT IS NEEDED ===
servicesToRun=()
servicesToHideLogs=()
additionalFlags=()

case $database in
postgresql)
Expand Down Expand Up @@ -624,4 +653,10 @@ if [ "$background" == "true" ]; then
additionalFlags+=("-d")
fi

docker_compose_up "${servicesToRun[*]} ${additionalFlags[*]} $(prefix_each '--no-attach ' ${servicesToHideLogs[*]})"
composeFilesArgs=""
for file in "${composeFiles[@]}"; do
composeFilesArgs+=" -f $file"
done

docker_compose_up "$composeFilesArgs" "${servicesToRun[*]} ${additionalFlags[*]} $(prefix_each '--no-attach ' ${servicesToHideLogs[*]})"

0 comments on commit b77de4f

Please sign in to comment.