diff --git a/docker-compose.yaml b/docker-compose.yaml index 4b701f8..2fd0181 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,9 +9,9 @@ services: - mongodb_data:/data/db - ./init-scripts/init.js:/docker-entrypoint-initdb.d/mongo-init.js environment: - - MONGO_INITDB_DATABASE=mydb - - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME:-root} - - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD:-root} + - MONGO_INITDB_DATABASE=${DB_DATABASE} + - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME} + - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD} platform: linux/arm64/v8 volumes: mongodb_data: \ No newline at end of file diff --git a/init-scripts/init.js b/init-scripts/init.js index 9ee3b37..b17b8e4 100755 --- a/init-scripts/init.js +++ b/init-scripts/init.js @@ -1,10 +1,6 @@ -db = db.getSiblingDB('test'); - db.createUser({ user: "rank_user", pwd: "12345", - roles: [{ role: "readWrite", db: "test" }] + roles: [{ role: "readWrite", db: "mydb" }] }); - -db.createCollection('rank_crawler');