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.

38 lines
911 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. HOST="$(relation-get host)"
  8. PORT="$(relation-get port)"
  9. ADMIN_PASSWORD=$(relation-base-compose-get admin-password 2>/dev/null) || {
  10. if [ -e "$CONFIG" ]; then
  11. ADMIN_PASSWORD=$(grep ^admin_passwd "$CONFIG" | sed -r 's/^admin_passwd\s+=\s+(.+)$/\1/g')
  12. fi
  13. if [ -z "$ADMIN_PASSWORD" ]; then
  14. info "Generating odoo admin password"
  15. ADMIN_PASSWORD=$(gen_password)
  16. fi
  17. }
  18. database=$(options-get database 2>/dev/null) || true
  19. database="${database:-$DBNAME}"
  20. config-add "\
  21. services:
  22. $MASTER_BASE_SERVICE_NAME:
  23. environment:
  24. DB_TYPE: \"postgres\"
  25. DB_HOST: \"$HOST\"
  26. DB_PORT: \"$PORT\"
  27. DB_NAME: \"$DBNAME\"
  28. DB_PWD: \"$PASSWORD\"
  29. DB_USER: \"$USER\"
  30. "
  31. info "Configured $SERVICE_NAME code for $HOST:$PORT access."