|
@@ -141,6 +141,11 @@ function drop_database_mongodb {
|
141
|
141
|
return
|
142
|
142
|
fi
|
143
|
143
|
mongo $database_name --eval "db.runCommand( { dropDatabase: 1 } )"
|
|
144
|
+ if [ $app_name ]; then
|
|
145
|
+ if grep -q "$app_name" $MONGODB_APPS_FILE; then
|
|
146
|
+ sed -i "/$app_name/d" $MONGODB_APPS_FILE
|
|
147
|
+ fi
|
|
148
|
+ fi
|
144
|
149
|
}
|
145
|
150
|
|
146
|
151
|
function initialise_database_mongodb {
|
|
@@ -157,4 +162,9 @@ function create_database_mongodb {
|
157
|
162
|
app_admin_password="$2"
|
158
|
163
|
app_admin_username=$3
|
159
|
164
|
mongo admin --eval "db.createUser({user: '$app_admin_username', pwd: '$app_admin_password', roles: [ { role: 'userAdminAnyDatabase', db: 'admin' } ] })"
|
|
165
|
+ if [ $app_name ]; then
|
|
166
|
+ if ! grep -q "$app_name" $MONGODB_APPS_FILE; then
|
|
167
|
+ echo "$app_name" >> $MONGODB_APPS_FILE
|
|
168
|
+ fi
|
|
169
|
+ fi
|
160
|
170
|
}
|