Refactor MongoDB data and log paths in run.sh
- Updated MONGO_DBPATH to use a new directory (.mongo-data) for database storage. - Removed MONGO_LOGPATH variable and its usage in the MongoDB startup command.
This commit is contained in:
+2
-3
@@ -2,8 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
MONGO_DBPATH="${MONGO_DBPATH:-$SCRIPT_DIR/data/db}"
|
||||
MONGO_LOGPATH="${MONGO_LOGPATH:-$SCRIPT_DIR/data/mongod.log}"
|
||||
MONGO_DBPATH="${MONGO_DBPATH:-$SCRIPT_DIR/.mongo-data}"
|
||||
|
||||
start_mongodb_if_needed() {
|
||||
if ! command -v mongod >/dev/null 2>&1; then
|
||||
@@ -18,7 +17,7 @@ start_mongodb_if_needed() {
|
||||
|
||||
mkdir -p "$MONGO_DBPATH"
|
||||
echo "Starting MongoDB with dbPath: $MONGO_DBPATH"
|
||||
mongod --dbpath "$MONGO_DBPATH" --bind_ip 127.0.0.1 --port 27017 --fork --logpath "$MONGO_LOGPATH"
|
||||
mongod --dbpath "$MONGO_DBPATH" --bind_ip 127.0.0.1 --port 27017
|
||||
}
|
||||
|
||||
start_mongodb_if_needed
|
||||
|
||||
Reference in New Issue
Block a user