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.

40 lines
1020 B

  1. #!/bin/bash
  2. ## XXXvlab: should get location of code
  3. #CONFIG=$(echo $COMPOSE_CONFIG | shyaml get-value $SERVICE_NAME.relations.publish-dir...)
  4. # CONFIG="$SERVICE_DATASTORE/opt/apps/piwigo/local/config/database.inc.php"
  5. set -e
  6. PASSWORD="$(relation-get password)"
  7. USER="$(relation-get user)"
  8. DBNAME="$(relation-get dbname)"
  9. # control=$(echo -en "$USER\0$DBNAME\0$PASSWORD" | md5_compat)
  10. #[ "$control" == "$(relation-get control)" ] && exit 0
  11. ## creation of config file is done through install.php in post_deploy
  12. ## Do not support \ and ' or \n in DBNAME, PASSWORD.
  13. # file_put "$CONFIG" <<EOF
  14. # <?php
  15. # \$conf['dblayer'] = 'mysqli';
  16. # \$conf['db_base'] = '$DBNAME';
  17. # \$conf['db_user'] = 'piwigo';
  18. # \$conf['db_password'] = '$PASSWORD';
  19. # \$conf['db_host'] = '$TARGET_SERVICE_NAME';
  20. # \$prefixeTable = '';
  21. # define('PWG_CHARSET', 'utf-8');
  22. # define('DB_CHARSET', 'utf8');
  23. # define('DB_COLLATE', '');
  24. # EOF
  25. # relation-set control "$control"
  26. info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access."