The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

28 linhas
827 B

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. if [[ -z "${BUBBLE_MAILGUN_API_KEY}" ]] ; then
  6. echo "BUBBLE_MAILGUN_API_KEY not defined in environment"
  7. exit 1
  8. fi
  9. API_BASE=https://api.mailgun.net/v3/
  10. URI="${1:?no uri}"
  11. POST_FILE="${2}"
  12. HTTP_METHOD=${3}
  13. function auth () {
  14. echo -n "Authorization: Basic $(echo -n "api:${BUBBLE_MAILGUN_API_KEY}" | base64)"
  15. }
  16. if [[ -n "${POST_FILE}" ]] ; then
  17. if [[ -z "${HTTP_METHOD}" ]] ; then
  18. curl -d @${POST_FILE} -s -H 'Content-Type: multipart/form-data' -H "$(auth)" ${API_BASE}${URI}
  19. else
  20. curl -d @${POST_FILE} -X ${HTTP_METHOD} -s -H 'Content-Type: multipart/form-data' -H "$(auth)" ${API_BASE}${URI}
  21. fi
  22. else
  23. curl -s -H "$(auth)" ${API_BASE}${URI}
  24. fi