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.

37 lines
943 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. # control=$(echo -en "$USER\0$DBNAME\0$PASSWORD\0$ADMIN_PASSWORD" | md5_compat)
  17. config-add "\
  18. services:
  19. $MASTER_BASE_SERVICE_NAME:
  20. environment:
  21. POSTGRES_HOST: $MASTER_TARGET_SERVICE_NAME
  22. POSTGRES_DB: $DBNAME
  23. POSTGRES_PASSWORD: $PASSWORD
  24. POSTGRES_USER: $USER
  25. "
  26. # [ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0
  27. # relation-set control "$control"
  28. info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access."