fork 0k-charms
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
1.2 KiB

  1. #!/bin/bash
  2. ## Init is run on host
  3. ## For now it is run every time the script is launched, but
  4. ## it should be launched only once after build.
  5. ## Accessible variables are:
  6. ## - SERVICE_NAME Name of current service
  7. ## - DOCKER_BASE_IMAGE Base image from which this service might be built if any
  8. ## - SERVICE_DATASTORE Location on host of the DATASTORE of this service
  9. ## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service
  10. # Please note that postgres detect on its own if its datadir needs to be populated
  11. . lib/common
  12. if ! [ -f "$HOST_CYCLOS_CONFIG" ]; then
  13. ## create cyclos.properties
  14. cyclos:build || exit 1
  15. fi
  16. if ! [ -f "$HOST_CYCLOS_CONFIG" ]; then
  17. err "No file '$HOST_CYCLOS_CONFIG'."
  18. return 1
  19. fi
  20. PROPS=(
  21. cyclos.header.remoteAddress X-Forwarded-For
  22. cyclos.header.protocol X-Forwarded-Proto
  23. )
  24. while read-0 label value; do
  25. sed -ri "s/^($label\s+=)\s*.*/\1 $value/g" "$HOST_CYCLOS_CONFIG" >&2
  26. done < <(array_values_to_stdin PROPS)
  27. init-config-add "
  28. $SERVICE_NAME:
  29. environment:
  30. JAVA_OPTS: >-
  31. -Dcyclos.cors.origin=*
  32. -Dcyclos.header.remoteAddress=X-Forwarded-For
  33. -Dcyclos.header.protocol=X-Forwarded-Proto
  34. "