From 2c46650e43b7c56afff3bdbca77db08d1e6f3ebd Mon Sep 17 00:00:00 2001 From: shancheas Date: Mon, 1 Jul 2024 11:09:19 +0700 Subject: [PATCH] chore: add docker configuration --- Dockerfile | 3 --- .../couch/data/services/couch.service.ts | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 19e5ddf..2ba1bfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,7 @@ COPY . . RUN yarn install RUN yarn build FROM node:18.17-alpine -ARG env_target WORKDIR /app -RUN echo ${env_target} -COPY env/$env_target /app/.env COPY --from=builder /app/env/$env_target .env COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/dist ./dist diff --git a/src/modules/configuration/couch/data/services/couch.service.ts b/src/modules/configuration/couch/data/services/couch.service.ts index 721736d..a91f88b 100644 --- a/src/modules/configuration/couch/data/services/couch.service.ts +++ b/src/modules/configuration/couch/data/services/couch.service.ts @@ -8,7 +8,9 @@ export class CouchService { constructor(private eventBus: EventBus) {} async onModuleInit() { - const nano = require('nano')('http://root:password@172.10.10.2:5970'); + const nano = require('nano')( + 'http://root:password@db_pos_couch_staging:5984', + ); for (const database of DatabaseListen) { const db = nano.db.use(database); db.changesReader.start({ includeDocs: true }).on('change', (change) => { @@ -31,7 +33,9 @@ export class CouchService { public async createDoc(data, database) { try { - const nano = require('nano')('http://root:password@172.10.10.2:5970'); + const nano = require('nano')( + 'http://root:password@db_pos_couch_staging:5984', + ); const db = nano.use(database); return await db.insert(data); } catch (error) {} @@ -39,7 +43,9 @@ export class CouchService { public async deleteDoc(data, database) { try { - const nano = require('nano')('http://root:password@172.10.10.2:5970'); + const nano = require('nano')( + 'http://root:password@db_pos_couch_staging:5984', + ); const db = nano.use(database); const result = await db.get(data.id); await db.destroy(data.id, result._rev); @@ -48,7 +54,9 @@ export class CouchService { public async updateDoc(data, database) { try { - const nano = require('nano')('http://root:password@172.10.10.2:5970'); + const nano = require('nano')( + 'http://root:password@db_pos_couch_staging:5984', + ); const db = nano.use(database); const result = await db.get(data.id); console.log(result, 'dsa');