From 86f3bf45ffe1d2d86152454fdcc53f2f64b4e150 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 27 Sep 2021 19:54:53 +0200 Subject: [PATCH] mongo init --- docker-compose.yml | 8 ++++++++ packages/ipfs-api/src/consts.ts | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 43ba063a..b08ca953 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -183,6 +183,8 @@ services: container_name: ipfs-api restart: unless-stopped logging: *default-logging + env_file: + - .env networks: shared: ipv4_address: 10.10.10.58 @@ -196,6 +198,12 @@ services: container_name: ipfs-mongo restart: unless-stopped logging: *default-logging + env_file: + - .env + environment: + - MONGO_INITDB_ROOT_USERNAME: ${IPFS_MONGO_USERNAME} + - MONGO_INITDB_ROOT_PASSWORD: ${IPFS_MONGO_PASSWORD} + - MONGO_INITDB_DATABASE: ipfs-to-skynet volumes: - ./docker/data/ipfs-mongo/db:/data/db networks: diff --git a/packages/ipfs-api/src/consts.ts b/packages/ipfs-api/src/consts.ts index 4ca1ce5f..7102cb25 100644 --- a/packages/ipfs-api/src/consts.ts +++ b/packages/ipfs-api/src/consts.ts @@ -6,7 +6,5 @@ export const IPFS_INFURA_API = export const IPFS_GATEWAY = process.env.IPFS_GATEWAY || "https://cloudflare-ipfs.com/ipfs/"; export const SKYNET_PORTAL = process.env.SKYNET_PORTAL || "https://siasky.net"; -export const MONGO_CONNECTIONSTRING = - process.env.MONGO_CONNECTIONSTRING || - "mongodb://root:password@ipfs-mongo:27017"; -export const MONGO_DBNAME = process.env.MONGO_DBNAME || "ipfs-to-skynet"; +export const MONGO_CONNECTIONSTRING = `mongodb://${process.env.IPFS_MONGO_USERNAME}:${process.env.IPFS_MONGO_PASSWORD}@ipfs-mongo:27017`; +export const MONGO_DBNAME = "ipfs-to-skynet";