#!/bin/bash ### DO NOT EDIT THIS FILE function shopware6BuildIgnoredTablesArguments { local env=$(getArgument "$1" "Usage: buildIgnoredTables [live|stage|local] [ignoredTablesArray]" "live stage local") local ignoredTables=$(getArgument "$2" "Usage: buildIgnoredTables [live|stage|local] [ignoredTablesArray]" true) local database_name=$(eval "echo \"\$${env}_database_name\"") ignoredTables=($ignoredTables) local ignoredTablesArguments="" for table in "${ignoredTables[@]}" do ignoredTablesArguments="$ignoredTablesArguments --ignore-table=\"${database_name}.${table}\"" done echo "$ignoredTablesArguments" } function shopware6GetSecret { local prop="$(getArgument "$1" "Usage: getSecret [APP_SECRET|INSTANCE_ID]" "APP_SECRET INSTANCE_ID")" local httpdocs_shopware_subpath="$(getConfig "local" "httpdocs_shopware_subpath")" local path="$app_dir/git/$project_name$httpdocs_shopware_subpath" app_secret="$(cat "$app_dir/etc/app_secret")" app_secret="$(if [ "$app_secret" == "" ]; then echo "$(_shopware6GetRemoteSecret "live" "$prop")"; else echo "$app_secret"; fi)" app_secret="$(if [ "$app_secret" == "" ]; then echo "$(_shopware6GetRemoteSecret "stage" "$prop")"; else echo "$app_secret"; fi)" app_secret="$(if [ "$app_secret" == "" ]; then echo "$(cat \""$path/.env"\" | sed -i -r "s/^$prop=\(.*\)\$/\\1/")"; else echo "$app_secret"; fi)" app_secret="$(if [ "$app_secret" == "" ]; then echo "$(_shopware6GenerateSecret)"; else echo "$app_secret"; fi)" } function _shopware6GetRemoteSecret { local env="$(getArgument "$1" "Usage: _getRemoteSecret [live|stage] [APP_SECRET|INSTANCE_ID]" "live stage")" local prop="$(getArgument "$2" "Usage: _getRemoteSecret [live|stage] [APP_SECRET|INSTANCE_ID]" "APP_SECRET INSTANCE_ID")" local ssh_user="$(getConfig "$env" "ssh_user")" local ssh_domain="$(getConfig "$env" "ssh_domain")" local httpdocs_path="$(getConfig "$env" "httpdocs_path")" local httpdocs_git_subpath="$(getConfig "$env" "httpdocs_git_subpath")" local httpdocs_shopware_subpath="$(getConfig "$env" "httpdocs_shopware_subpath")" local path="$httpdocs_path$httpdocs_git_subpath$httpdocs_shopware_subpath" addSSHKey "$env" echo "$(ssh "$ssh_user"@"$ssh_domain" "cat \"$path/.env"\" | sed -i -r "s/^$prop=\(.*\)\$/\\1/")" } function _shopware6GenerateSecret { echo openssl rand -hex 32 }