perform mariadb/mongodb module installation only with generated code

This commit is contained in:
Sameer Naik
2017-01-13 11:35:46 +05:30
parent fa9056bbf2
commit c26ac0ae35

View File

@@ -52,7 +52,7 @@ wait_for_db() {
fi
}
setup_db() {
add_database_support() {
if getent hosts mongodb >/dev/null && ! npm ls mongodb >/dev/null; then
npm install --save mongodb
fi
@@ -67,10 +67,18 @@ log () {
}
if [ "$1" == npm -a "$2" == "start" ]; then
if database_tier_exists; then
wait_for_db
fi
if ! app_present; then
log "Creating express application"
express . -f
if database_tier_exists; then
add_database_support
fi
log "Adding dist samples"
cp -r /dist/samples .
fi
@@ -81,10 +89,6 @@ if [ "$1" == npm -a "$2" == "start" ]; then
log "Dependencies updated"
fi
if database_tier_exists; then
wait_for_db
fi
if ! fresh_container; then
echo "#########################################################################"
echo " "
@@ -95,9 +99,7 @@ if [ "$1" == npm -a "$2" == "start" ]; then
echo " "
echo "#########################################################################"
else
if database_tier_exists; then
setup_db
fi
# Perform any app initialization tasks here.
log "Initialization finished"
fi