moved database_tier_exists check inside add_database_support function

This commit is contained in:
Sameer Naik
2017-01-17 16:18:58 +05:30
parent 49c19815ba
commit a2af0e205b

View File

@@ -59,16 +59,18 @@ wait_for_db() {
} }
add_database_support() { add_database_support() {
if getent hosts mongodb >/dev/null && ! npm ls mongodb >/dev/null; then if database_tier_exists; then
npm install --save mongodb if getent hosts mongodb >/dev/null && ! npm ls mongodb >/dev/null; then
fi npm install --save mongodb
fi
if getent hosts mariadb >/dev/null && ! npm ls mysql >/dev/null; then if getent hosts mariadb >/dev/null && ! npm ls mysql >/dev/null; then
npm install --save mysql npm install --save mysql
fi fi
if getent hosts postgresql >/dev/null && ! npm ls pg pg-hstore >/dev/null; then if getent hosts postgresql >/dev/null && ! npm ls pg pg-hstore >/dev/null; then
npm install --save pg pg-hstore npm install --save pg pg-hstore
fi
fi fi
} }
@@ -103,11 +105,7 @@ if [ "$1" == npm ] && [ "$2" == "start" -o "$2" == "run" ]; then
if ! app_present; then if ! app_present; then
log "Creating express application" log "Creating express application"
express . -f express . -f
add_database_support
if database_tier_exists; then
add_database_support
fi
add_sample_code add_sample_code
fi fi