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.
43 lines
855 B
43 lines
855 B
#!/bin/bash
|
|
|
|
. lib/common
|
|
|
|
set -e
|
|
|
|
DBNAME="$(relation-get dbname)" || exit 1
|
|
|
|
initing="${GOGOCARTO_CODE}"/.initing-${DBNAME}
|
|
if [ -e "$initing" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
|
|
inited="${GOGOCARTO_CODE}"/.inited-${DBNAME}
|
|
|
|
MONGO_URL=mongodb://${TARGET_SERVICE_NAME}:27017/${DBNAME}
|
|
|
|
|
|
cat <<EOF >> ${GOGOCARTO_CODE}/.env
|
|
|
|
###> doctrine/mongodb-odm-bundle ###
|
|
MONGODB_URL=$MONGO_URL
|
|
###< doctrine/mongodb-odm-bundle ###
|
|
|
|
EOF
|
|
|
|
if [ -e "$inited" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
## came from ``Makefile`` in git's gogocarto source code. Target load-fixtures.
|
|
touch "$initing"
|
|
trap_add EXIT,ERR "rm -v \"$initing\""
|
|
symphony doctrine:mongodb:schema:create &&
|
|
symphony doctrine:mongodb:generate:hydrators &&
|
|
symphony doctrine:mongodb:generate:proxies &&
|
|
symphony doctrine:mongodb:fixtures:load -n || {
|
|
err "Mongo database initialization failed."
|
|
exit 1
|
|
}
|
|
|
|
touch "$inited"
|