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

#!/bin/bash
## XXXvlab: should get location of code
#CONFIG=$(echo $COMPOSE_CONFIG | shyaml get-value $SERVICE_NAME.relations.publish-dir...)
# CONFIG="$SERVICE_DATASTORE/opt/apps/piwigo/local/config/database.inc.php"
set -e
PASSWORD="$(relation-get password)"
USER="$(relation-get user)"
DBNAME="$(relation-get dbname)"
# control=$(echo -en "$USER\0$DBNAME\0$PASSWORD" | md5_compat)
#[ "$control" == "$(relation-get control)" ] && exit 0
## creation of config file is done through install.php in post_deploy
## Do not support \ and ' or \n in DBNAME, PASSWORD.
# file_put "$CONFIG" <<EOF
# <?php
# \$conf['dblayer'] = 'mysqli';
# \$conf['db_base'] = '$DBNAME';
# \$conf['db_user'] = 'piwigo';
# \$conf['db_password'] = '$PASSWORD';
# \$conf['db_host'] = '$TARGET_SERVICE_NAME';
# \$prefixeTable = '';
# define('PWG_CHARSET', 'utf-8');
# define('DB_CHARSET', 'utf8');
# define('DB_COLLATE', '');
# EOF
# relation-set control "$control"
info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access."