From 3654746033f72f3f3dafa0bdff48a26ff2882f26 Mon Sep 17 00:00:00 2001 From: HRulier Date: Thu, 30 Apr 2026 17:13:37 +0200 Subject: [PATCH 1/7] fix(slack and google auth): add logs --- src/controllers/auth.controller.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/controllers/auth.controller.ts b/src/controllers/auth.controller.ts index 8a8b882..cb092cb 100644 --- a/src/controllers/auth.controller.ts +++ b/src/controllers/auth.controller.ts @@ -161,6 +161,8 @@ async function loginWithGoogleCallback( next: NextFunction, ) { passport.authenticate("google", { session: false }, (err, data) => { + console.log("loginWithGoogleCallback", err, data); + if (err || !data) { return res.redirect( `${process.env.FRONT_URL}/signin?error=auth_google_failed`, @@ -244,6 +246,7 @@ async function loginWithSlackCallback( next: NextFunction, ) { passport.authenticate("Slack", { session: false }, (err: any, data: any) => { + console.log("loginWithSlackCallback", err, data); if (err || !data) { return res.redirect( `${process.env.FRONT_URL}/signin?error=auth_slack_failed`, From 92fe54cbb52f848633611a3063af9b0b9060f53d Mon Sep 17 00:00:00 2001 From: HRulier Date: Thu, 30 Apr 2026 17:43:49 +0200 Subject: [PATCH 2/7] fix(docker): fix node alpine version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c731043..d61f6f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Base -FROM node:lts-alpine AS base +FROM node:20-alpine AS base WORKDIR /app COPY package*.json ./ From 5c3900470d917dc5c1263326c6854987c9764cd4 Mon Sep 17 00:00:00 2001 From: HRulier Date: Thu, 30 Apr 2026 17:48:58 +0200 Subject: [PATCH 3/7] fix(docker): fix node alpine version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d61f6f4..830df41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ COPY . . RUN npm run build # Production -FROM node:lts-alpine AS production +FROM node:20-alpine AS production ENV NODE_ENV='production' RUN addgroup --system --gid 1001 nodejs From 28b4134d29d72becf81ddd5b9924d5ff00b31eda Mon Sep 17 00:00:00 2001 From: HRulier Date: Thu, 30 Apr 2026 18:25:08 +0200 Subject: [PATCH 4/7] fix(docker): try with node 22 alpine --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 830df41..bedf1ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Base -FROM node:20-alpine AS base +FROM node:22-alpine AS base WORKDIR /app COPY package*.json ./ @@ -21,7 +21,7 @@ COPY . . RUN npm run build # Production -FROM node:20-alpine AS production +FROM node:22-alpine AS production ENV NODE_ENV='production' RUN addgroup --system --gid 1001 nodejs From 24c40a2535170c81c662971456aebf822209b317 Mon Sep 17 00:00:00 2001 From: HRulier Date: Thu, 30 Apr 2026 19:02:36 +0200 Subject: [PATCH 5/7] fix(slack and google auth): remove logs --- src/controllers/auth.controller.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/controllers/auth.controller.ts b/src/controllers/auth.controller.ts index cb092cb..8a8b882 100644 --- a/src/controllers/auth.controller.ts +++ b/src/controllers/auth.controller.ts @@ -161,8 +161,6 @@ async function loginWithGoogleCallback( next: NextFunction, ) { passport.authenticate("google", { session: false }, (err, data) => { - console.log("loginWithGoogleCallback", err, data); - if (err || !data) { return res.redirect( `${process.env.FRONT_URL}/signin?error=auth_google_failed`, @@ -246,7 +244,6 @@ async function loginWithSlackCallback( next: NextFunction, ) { passport.authenticate("Slack", { session: false }, (err: any, data: any) => { - console.log("loginWithSlackCallback", err, data); if (err || !data) { return res.redirect( `${process.env.FRONT_URL}/signin?error=auth_slack_failed`, From ae593f81cc36ea04d4b670a41c4b617a9bc234e6 Mon Sep 17 00:00:00 2001 From: HRulier Date: Fri, 8 May 2026 10:42:58 +0200 Subject: [PATCH 6/7] chore(ci): add NODE_ENV=test support for test environment config with .env.test --- .gitignore | 4 +++- package.json | 6 +++--- src/config/dot-env.ts | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 1fd5e22..021c031 100755 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ dist/ structure.md CLAUDE.md -/docs/* \ No newline at end of file +/docs/* + +test-mcp-oauth.sh \ No newline at end of file diff --git a/package.json b/package.json index 1afb998..f642183 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "dev": "ts-node-dev --respawn --transpile-only -r tsconfig-paths/register src/index.ts", "build": "cross-env NODE_ENV=production tsc && tsc-alias", "start": "cross-env NODE_ENV=production node dist/src/index.js", - "test": "jest --detectOpenHandles", - "test:watch": "jest --watchAll --detectOpenHandles --forceExit", - "test:coverage": "jest --coverage" + "test": "cross-env NODE_ENV=test jest --detectOpenHandles", + "test:watch": "cross-env NODE_ENV=test jest --watchAll --detectOpenHandles --forceExit", + "test:coverage": "cross-env NODE_ENV=test jest --coverage" }, "repository": { "type": "git", diff --git a/src/config/dot-env.ts b/src/config/dot-env.ts index 2f043b0..19ddee4 100755 --- a/src/config/dot-env.ts +++ b/src/config/dot-env.ts @@ -10,4 +10,8 @@ if (process.env.DOCKER !== "true" && process.env.NODE_ENV === "production") { envConfig.path = "./.env.production"; } +if (process.env.NODE_ENV === "test") { + envConfig.path = "./.env.test"; +} + export default envConfig; From ad930c7abd261eb274025e0a7008494026b860d9 Mon Sep 17 00:00:00 2001 From: HRulier Date: Fri, 8 May 2026 11:02:43 +0200 Subject: [PATCH 7/7] ci: add test job as deployment safety net --- .github/workflows/deploy.yml | 43 ++++++++++++++++++++++++++++++++++-- src/config/dot-env.ts | 2 +- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index aec95af..3e0417a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,15 +6,54 @@ on: - development jobs: + test: + runs-on: ubuntu-latest + environment: test + + services: + mongodb: + image: mongo:8 + ports: + - 27017:27017 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Run tests + env: + NODE_ENV: test + MONGODB_TEST_URI: mongodb://localhost:27017/test-ci + ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} + REFRESH_TOKEN_SECRET: ${{ secrets.REFRESH_TOKEN_SECRET }} + API_KEY: ${{ secrets.API_KEY }} + ACCESS_TOKEN_EXPIRES: 1m + REFRESH_TOKEN_EXPIRES: 7d + GOOGLE_CLIENT_ID: dummy + GOOGLE_CLIENT_SECRET: dummy + SLACK_CLIENT_ID: dummy + SLACK_CLIENT_SECRET: dummy + run: npm test + deploy: runs-on: ubuntu-latest + needs: test steps: - name: Checkout code - uses: actions/checkout@v4 # Updated version + uses: actions/checkout@v4 - name: Add SSH private key to agent - uses: webfactory/ssh-agent@v0.9.0 # Updated version + uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/src/config/dot-env.ts b/src/config/dot-env.ts index 19ddee4..099637d 100755 --- a/src/config/dot-env.ts +++ b/src/config/dot-env.ts @@ -10,7 +10,7 @@ if (process.env.DOCKER !== "true" && process.env.NODE_ENV === "production") { envConfig.path = "./.env.production"; } -if (process.env.NODE_ENV === "test") { +if (process.env.DOCKER !== "true" && process.env.NODE_ENV === "test") { envConfig.path = "./.env.test"; }