Ein für Shopware 6 vorbereitet Systemmanagment.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.3 KiB

  1. #!/bin/bash
  2. function shopware6BuildIgnoredTablesArguments {
  3. local env=$(getArgument "$1" "Usage: buildIgnoredTables [live|stage|local] [ignoredTablesArray]" "live stage local")
  4. local ignoredTables=$(getArgument "$2" "Usage: buildIgnoredTables [live|stage|local] [ignoredTablesArray]" true)
  5. local database_name=$(eval "echo \"\$${env}_database_name\"")
  6. ignoredTables=($ignoredTables)
  7. local ignoredTablesArguments=""
  8. for table in "${ignoredTables[@]}"
  9. do
  10. ignoredTablesArguments="$ignoredTablesArguments --ignore-table=\"${database_name}.${table}\""
  11. done
  12. echo "$ignoredTablesArguments"
  13. }
  14. function shopware6GetSecret {
  15. local prop="$(getArgument "$1" "Usage: getSecret [APP_SECRET|INSTANCE_ID]" "APP_SECRET INSTANCE_ID")"
  16. local httpdocs_shopware_subpath="$(getConfig "local" "httpdocs_shopware_subpath")"
  17. local path="$app_dir/git/$project_name$httpdocs_shopware_subpath"
  18. app_secret="$(cat "$app_dir/etc/app_secret")"
  19. app_secret="$(if [ "$app_secret" == "" ]; then echo "$(_shopware6GetRemoteSecret "live" "$prop")"; else echo "$app_secret"; fi)"
  20. app_secret="$(if [ "$app_secret" == "" ]; then echo "$(_shopware6GetRemoteSecret "stage" "$prop")"; else echo "$app_secret"; fi)"
  21. app_secret="$(if [ "$app_secret" == "" ]; then echo "$(cat \""$path/.env"\" | sed -i -r "s/^$prop=\(.*\)\$/\\1/")"; else echo "$app_secret"; fi)"
  22. app_secret="$(if [ "$app_secret" == "" ]; then echo "$(_shopware6GenerateSecret)"; else echo "$app_secret"; fi)"
  23. }
  24. function _shopware6GetRemoteSecret {
  25. local env="$(getArgument "$1" "Usage: _getRemoteSecret [live|stage] [APP_SECRET|INSTANCE_ID]" "live stage")"
  26. local prop="$(getArgument "$2" "Usage: _getRemoteSecret [live|stage] [APP_SECRET|INSTANCE_ID]" "APP_SECRET INSTANCE_ID")"
  27. local ssh_user="$(getConfig "$env" "ssh_user")"
  28. local ssh_domain="$(getConfig "$env" "ssh_domain")"
  29. local httpdocs_path="$(getConfig "$env" "httpdocs_path")"
  30. local httpdocs_git_subpath="$(getConfig "$env" "httpdocs_git_subpath")"
  31. local httpdocs_shopware_subpath="$(getConfig "$env" "httpdocs_shopware_subpath")"
  32. local path="$httpdocs_path$httpdocs_git_subpath$httpdocs_shopware_subpath"
  33. addSSHKey "$env"
  34. echo "$(ssh "$ssh_user"@"$ssh_domain" "cat \"$path/.env"\" | sed -i -r "s/^$prop=\(.*\)\$/\\1/")"
  35. }
  36. function _shopware6GenerateSecret {
  37. echo openssl rand -hex 32
  38. }