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.

34 lines
860 B

  1. #!/bin/bash
  2. . lib/common
  3. set -e
  4. PASSWORD="$(relation-get password)"
  5. USER="$(relation-get user)"
  6. DBNAME="$(relation-get dbname)"
  7. ADMIN_PASSWORD=$(relation-base-compose-get admin-password 2>/dev/null) || {
  8. if [ -e "$CONFIG" ]; then
  9. ADMIN_PASSWORD=$(grep ^admin_passwd "$CONFIG" | sed -r 's/^admin_passwd\s+=\s+(.+)$/\1/g')
  10. fi
  11. if [ -z "$ADMIN_PASSWORD" ]; then
  12. info "Generating odoo admin password"
  13. ADMIN_PASSWORD=$(gen_password)
  14. fi
  15. }
  16. database=$(options-get database 2>/dev/null) || true
  17. database="${database:-$DBNAME}"
  18. config-add "\
  19. services:
  20. $MASTER_BASE_SERVICE_NAME:
  21. environment:
  22. DB_TYPE: \"postgres\"
  23. DB_HOST: \"$MASTER_TARGET_SERVICE_NAME\"
  24. DB_NAME: \"$DBNAME\"
  25. DB_PWD: \"$PASSWORD\"
  26. DB_USER: \"$USER\"
  27. "
  28. info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access."