From 414af257218a730babb49338308494917d3c4347 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 12 Aug 2024 16:20:33 +0400 Subject: [PATCH 1/6] refactor: move filters to shared --- src/main.ts | 2 +- src/shared/filters/http-exception.filter.ts | 57 +++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/shared/filters/http-exception.filter.ts diff --git a/src/main.ts b/src/main.ts index 2708726..9c50751 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,7 +7,7 @@ import { Logger, LoggerErrorInterceptor } from 'nestjs-pino' import * as session from 'express-session' import { VersioningType, ValidationPipe } from '@nestjs/common' import { setupSwagger } from './doc' -import { HttpExceptionFilter } from './filters/http-exception.filter' +import { HttpExceptionFilter } from './shared/filters/http-exception.filter' async function bootstrap() { const app = await NestFactory.create(AppModule, { bufferLogs: true }) diff --git a/src/shared/filters/http-exception.filter.ts b/src/shared/filters/http-exception.filter.ts new file mode 100644 index 0000000..dbe6a2a --- /dev/null +++ b/src/shared/filters/http-exception.filter.ts @@ -0,0 +1,57 @@ +import { + ExceptionFilter, + Catch, + ArgumentsHost, + HttpException, + HttpStatus, + Logger, +} from '@nestjs/common' +import { Request, Response } from 'express' + +@Catch() +export class HttpExceptionFilter implements ExceptionFilter { + private readonly logger = new Logger(HttpExceptionFilter.name) + + catch(exception: unknown, host: ArgumentsHost) { + const ctx = host.switchToHttp() + const response = ctx.getResponse() + const request = ctx.getRequest() + + const status = + exception instanceof HttpException + ? exception.getStatus() + : HttpStatus.INTERNAL_SERVER_ERROR + const message = + exception instanceof HttpException + ? exception.getResponse() + : 'Internal Server Error' + + this.logger.error({ + type: exception instanceof HttpException ? exception.name : 'Error', + message: + exception instanceof HttpException + ? exception.message + : 'Internal server error', + stack: exception instanceof HttpException ? exception.stack : '', + status, + response: message, + request: { + method: request.method, + url: request.url, + headers: request.headers, + body: request.body, + params: request.params, + query: request.query, + remoteAddress: request.ip, + remotePort: request.socket.remotePort, + }, + }) + + response.status(status).json({ + statusCode: status, + timestamp: new Date().toISOString(), + path: request.url, + message: message, + }) + } +} From 33f4416e9d01df31cd4d9a92f16f1106e3cf4ff1 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 12 Aug 2024 16:22:58 +0400 Subject: [PATCH 2/6] test: add lit tests --- src/filters/http-exception.filter.ts | 57 ------- src/lit/lit.service.spec.ts | 212 +++++++++++++++++++++++++++ 2 files changed, 212 insertions(+), 57 deletions(-) delete mode 100644 src/filters/http-exception.filter.ts create mode 100644 src/lit/lit.service.spec.ts diff --git a/src/filters/http-exception.filter.ts b/src/filters/http-exception.filter.ts deleted file mode 100644 index dbe6a2a..0000000 --- a/src/filters/http-exception.filter.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { - ExceptionFilter, - Catch, - ArgumentsHost, - HttpException, - HttpStatus, - Logger, -} from '@nestjs/common' -import { Request, Response } from 'express' - -@Catch() -export class HttpExceptionFilter implements ExceptionFilter { - private readonly logger = new Logger(HttpExceptionFilter.name) - - catch(exception: unknown, host: ArgumentsHost) { - const ctx = host.switchToHttp() - const response = ctx.getResponse() - const request = ctx.getRequest() - - const status = - exception instanceof HttpException - ? exception.getStatus() - : HttpStatus.INTERNAL_SERVER_ERROR - const message = - exception instanceof HttpException - ? exception.getResponse() - : 'Internal Server Error' - - this.logger.error({ - type: exception instanceof HttpException ? exception.name : 'Error', - message: - exception instanceof HttpException - ? exception.message - : 'Internal server error', - stack: exception instanceof HttpException ? exception.stack : '', - status, - response: message, - request: { - method: request.method, - url: request.url, - headers: request.headers, - body: request.body, - params: request.params, - query: request.query, - remoteAddress: request.ip, - remotePort: request.socket.remotePort, - }, - }) - - response.status(status).json({ - statusCode: status, - timestamp: new Date().toISOString(), - path: request.url, - message: message, - }) - } -} diff --git a/src/lit/lit.service.spec.ts b/src/lit/lit.service.spec.ts new file mode 100644 index 0000000..7a5adab --- /dev/null +++ b/src/lit/lit.service.spec.ts @@ -0,0 +1,212 @@ +import { Test, TestingModule } from '@nestjs/testing' +import { LitService } from './lit.service' +import { ConfigService } from '@nestjs/config' +import { Logger } from '@nestjs/common' +import { + LitNodeClientNodeJs, + encryptToJson, +} from '@lit-protocol/lit-node-client-nodejs' +import { keccak256, toHex, Address } from 'viem' +import { SupportedChainId } from '../shared/types/chain.type' + +jest.mock('@lit-protocol/lit-node-client-nodejs', () => ({ + LitNodeClientNodeJs: jest.fn().mockImplementation(() => ({ + connect: jest.fn().mockResolvedValue(null), + disconnect: jest.fn().mockResolvedValue(null), + })), + encryptToJson: jest.fn().mockResolvedValue('encryptedData'), +})) + +describe('LitService', () => { + let service: LitService + let litNodeClient: LitNodeClientNodeJs + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + LitService, + { + provide: ConfigService, + useValue: { + get: jest.fn().mockImplementation((key: string) => { + if (key === 'lit.network') { + return 'datil-dev' + } + return null + }), + }, + }, + { + provide: Logger, + useValue: { + error: jest.fn(), + }, + }, + ], + }).compile() + service = module.get(LitService) + litNodeClient = new LitNodeClientNodeJs({ + alertWhenUnauthorized: false, + litNetwork: 'datil-dev', + debug: true, + }) + service['litNodeClient'] = litNodeClient + }) + + it('should be defined', () => { + expect(service).toBeDefined() + }) + + // describe('connect', () => { + // it('should connect to the Lit node client', async () => { + // await service.connect() + + // // Assert that the LitNodeClientNodeJs constructor was called with the expected config + // expect(litNodeClientConstructorSpy).toHaveBeenCalledWith({ + // alertWhenUnauthorized: false, + // litNetwork: 'datil-dev', + // debug: true, + // }) + + // // Get the instance created by the constructor spy + // const litNodeClientInstance = + // litNodeClientConstructorSpy.mock.instances[0] + + // // Ensure the connect method was called on this instance + // expect(litNodeClientInstance.connect).toHaveBeenCalled() + // }) + // }) + + describe('disconnect', () => { + it('should disconnect from the Lit node client', async () => { + const litNodeClient = service['litNodeClient'] + await service.disconnect() + expect(litNodeClient.disconnect).toHaveBeenCalled() + expect(service['litNodeClient']).toBeNull() + }) + }) + + describe('getNetworkConfig', () => { + it('should return the correct network configuration', () => { + const mockNetworkConfig = { litNetwork: 'test-network' } + service['getNetworkConfig'] = jest + .fn() + .mockReturnValue(mockNetworkConfig) + + expect(service.getNetworkConfig('test-network')).toEqual( + mockNetworkConfig + ) + }) + it('should throw an error if the network is unsupported', () => { + expect(() => + service.getNetworkConfig('unsupported-network') + ).toThrow(Error('Unsupported lit network: unsupported-network')) + }) + }) + + describe('getContractAddress', () => { + it('should return the correct contract address for a supported chain ID', () => { + const mockChain = { + chainId: 1, + permissionManagerContractAddress: '0x123', + } + service['getContractAddress'] = jest + .fn() + .mockReturnValue(mockChain.permissionManagerContractAddress) + + expect(service.getContractAddress(1 as SupportedChainId)).toBe( + '0x123' + ) + }) + + it('should throw an error if the chain ID is unsupported', () => { + expect(() => + service.getContractAbi(999 as SupportedChainId) + ).toThrow(Error('Unsupported chain ID: 999')) + }) + }) + + describe('generateEvmContractConditions', () => { + it('should generate the correct EVM contract conditions', () => { + const chainId = 1 as SupportedChainId + const userAddress: Address = '0xUser' + const mockConditions = [ + { + contractAddress: '0x123', + functionName: 'testFunction', + functionParams: [ + keccak256(toHex(userAddress)), + ':userAddress', + ], + functionAbi: {}, + chain: 'ethereum', + returnValueTest: { + key: '', + comparator: '=', + value: 'true', + }, + }, + ] + + service['getContractAddress'] = jest.fn().mockReturnValue('0x123') + service['getContractFunctionName'] = jest + .fn() + .mockReturnValue('testFunction') + service['getContractAbi'] = jest.fn().mockReturnValue({}) + + const conditions = service.generateEvmContractConditions( + chainId, + userAddress + ) + expect(conditions).toEqual(mockConditions) + }) + + it('should throw an error if the chain ID is unsupported', () => { + expect(() => + service.getContractFunctionName(999 as SupportedChainId) + ).toThrow(Error('Unsupported chain ID: 999')) + }) + }) + + describe('encrypt', () => { + it('should successfully encrypt data', async () => { + const chainId = 1 as SupportedChainId + const dataToEncrypt = { test: 'data' } + const userAddress: Address = '0xUser' + const mockEncryptedData = 'encryptedData' + + service['generateEvmContractConditions'] = jest + .fn() + .mockReturnValue([]) + ;(encryptToJson as jest.Mock).mockResolvedValue(mockEncryptedData) + + const result = await service.encrypt( + chainId, + dataToEncrypt, + userAddress + ) + expect(result).toBe(mockEncryptedData) + expect(encryptToJson).toHaveBeenCalledWith({ + string: JSON.stringify(dataToEncrypt), + evmContractConditions: [], + litNodeClient: service['litNodeClient'], + chain: 'ethereum', + }) + }) + // it('should throw an InternalServerErrorException if encryption fails', async () => { + // const chainId = 1 as SupportedChainId + // const dataToEncrypt = { test: 'data' } + // const userAddress: Address = '0xUser' + + // service['generateEvmContractConditions'] = jest + // .fn() + // .mockReturnValue([]) + // ;(encryptToJson as jest.Mock).mockRejectedValue( + // new Error('Encryption failed') + // ) + + // await expect( + // service.encrypt(chainId, dataToEncrypt, userAddress) + // ).rejects.toThrow(InternalServerErrorException) + // }) + }) +}) From d83af97533f8f525948a8251f1af85c78ae138ef Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 12 Aug 2024 16:28:00 +0400 Subject: [PATCH 3/6] ci: add build-push --- .github/workflows/build-push.yml | 34 ++++++++++++ .github/workflows/ci.yml | 92 +++++++++++++------------------- 2 files changed, 70 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/build-push.yml diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml new file mode 100644 index 0000000..dc6b282 --- /dev/null +++ b/.github/workflows/build-push.yml @@ -0,0 +1,34 @@ +on: + workflow_call: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-push: + name: Build + Push Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/metadata-action@v5 + id: meta + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - uses: docker/build-push-action@v5 + with: + context: . + target: prod + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fc3850..8cb8167 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,65 +1,45 @@ name: CI Pipeline on: - push: - branches: - - '**' + push: + branches: + - '**' env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: super-linter/super-linter@v5.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TYPESCRIPT_DEFAULT_STYLE: prettier - VALIDATE_DOCKERFILE_HADOLINT: false - VALIDATE_JSCPD: false - VALIDATE_PYTHON_FLAKE8: false - VALIDATE_PYTHON_MYPY: false + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: super-linter/super-linter@v5.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TYPESCRIPT_DEFAULT_STYLE: prettier + VALIDATE_DOCKERFILE_HADOLINT: false + VALIDATE_JSCPD: false + VALIDATE_PYTHON_FLAKE8: false + VALIDATE_PYTHON_MYPY: false - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: 'npm' - - run: npm install --force - - run: npm run test - - uses: paambaati/codeclimate-action@v5.0.0 - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - with: - coverageCommand: npm run test:cov + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: 'npm' + - run: npm install --force + - run: npm run test + - uses: paambaati/codeclimate-action@v5.0.0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + with: + coverageCommand: npm run test:cov - # build-push: - # name: Build and Push Image - # runs-on: ubuntu-latest - # needs: [lint, test] - # steps: - # - uses: actions/checkout@v4 - # - uses: docker/setup-buildx-action@v3 - # - uses: docker/login-action@v3 - # with: - # registry: ${{ env.REGISTRY }} - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} - # - uses: docker/metadata-action@v5 - # id: meta - # with: - # images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # - uses: docker/build-push-action@v5 - # with: - # context: . - # target: prod - # push: true - # tags: ${{ steps.meta.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} + build-push: + needs: [lint, test] + uses: ./.github/workflows/build-push.yml From 426d0e6e5b57c5afd3d8fa31c62ddbe876aaef84 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 12 Aug 2024 16:36:50 +0400 Subject: [PATCH 4/6] fix: update jest and dockerfile --- .github/workflows/build-push.yml | 2 +- jest.config.json | 36 +++++++++++--------------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index dc6b282..728833c 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -28,7 +28,7 @@ jobs: - uses: docker/build-push-action@v5 with: context: . - target: prod + target: production push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/jest.config.json b/jest.config.json index 6f708b0..d1d8a6f 100644 --- a/jest.config.json +++ b/jest.config.json @@ -1,25 +1,13 @@ { - "moduleFileExtensions": [ - "js", - "json", - "ts" - ], - "rootDir": ".", - "testRegex": ".*\\.spec\\.ts$", - "transform": { - "^.+\\.(t|j)s$": "ts-jest" - }, - "collectCoverage": true, - "collectCoverageFrom": [ - "**/*.(t|j)s" - ], - "coverageDirectory": "./coverage", - "coverageReporters": [ - "json", - "lcov", - "text", - "clover", - "html" - ], - "testEnvironment": "node" -} \ No newline at end of file + "moduleFileExtensions": ["js", "json", "ts"], + "rootDir": ".", + "testRegex": ".*\\.spec\\.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + }, + "collectCoverage": true, + "collectCoverageFrom": ["src/**/*.ts*"], + "coverageDirectory": "./coverage", + "coverageReporters": ["json", "lcov", "text", "clover", "html"], + "testEnvironment": "node" +} From ee54e2e894e9eb0ddbc4adb006eef9c96530c9d5 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 12 Aug 2024 17:02:35 +0400 Subject: [PATCH 5/6] ci: fixing docker issues --- Dockerfile | 4 +- docker-compose.dev.yml | 48 +++++++++++-------- docker-compose.prod.yml | 43 +++++++++-------- docker-compose.test.yml | 43 +++++++++-------- .../config/auth-discord.config.ts | 1 + 5 files changed, 78 insertions(+), 61 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c2ef1e..4c14219 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,11 +16,11 @@ EXPOSE 3000 CMD ["npm", "run", "start:dev"] # Stage 3: Production -FROM node:20-alpine AS production +FROM node:20-alpine AS production WORKDIR /app COPY --from=builder /app . COPY . . -RUN npm install --only=production +RUN npm install --only=production --ignore-scripts EXPOSE 3000 CMD ["node", "dist/main"] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 9b9a481..c02bf0e 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,23 +1,29 @@ -version: "3.9" +version: '3.9' services: - app: - build: - context: . - target: development - dockerfile: Dockerfile - environment: - - NODE_ENV=development - - PORT=3000 - - GOOGLE_CLIENT_ID=x - - GOOGLE_CLIENT_SECRET=y - - GOOGLE_CALLBACK_URI=https://github.com/brocoders/nestjs-boilerplate/tree/main/src - - DISCORD_CLIENT_ID=v - - DISCORD_CLIENT_SECRET=b - - DISCORD_CALLBACK_URI=https://github.com/brocoders/nestjs-boilerplate/tree/main/src - - JWT_SECRET=t - - LOG_LEVEL=trace - ports: - - "3000:3000" - volumes: - - ./coverage:/project/coverage \ No newline at end of file + app: + build: + context: . + target: development + dockerfile: Dockerfile + environment: + - NODE_ENV=development + - PORT=3000 + - DISCORD_CLIENT_ID=x + - DISCORD_CLIENT_SECRET=-x + - DISCORD_REDIRECT_URI=http://localhost:4000/api/v1/auth/discord/authenticate/callback + - GOOGLE_CLIENT_ID=x + - GOOGLE_CLIENT_SECRET=x + - GOOGLE_REDIRECT_URI=http://localhost:4000/api/v1/auth/google/authenticate/callback + - SESSION_SECRET=x + - JWT_SECRET=x + - WALLET_PRIVATE_KEY=0x85167e00aeed1db6a59945f1f78f997856e2e312cf4e55cde90b740b71f9808c + - WALLET_PUBLIC_KEY=x + - LOG_LEVEL=info + - FRONTEND_URL=http://localhost:3000 + - LIT_NETWORK=datil-dev + + ports: + - '3000:3000' + volumes: + - ./coverage:/project/coverage diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 20a775f..9acf3e5 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,21 +1,26 @@ -version: "3.9" +version: '3.9' services: - app: - build: - context: . - target: prod - dockerfile: Dockerfile - environment: - - NODE_ENV=production - - PORT=3000 - - GOOGLE_CLIENT_ID=x - - GOOGLE_CLIENT_SECRET=y - - GOOGLE_CALLBACK_URI=https://github.com/brocoders/nestjs-boilerplate/tree/main/src - - DISCORD_CLIENT_ID=v - - DISCORD_CLIENT_SECRET=b - - DISCORD_CALLBACK_URI=https://github.com/brocoders/nestjs-boilerplate/tree/main/src - - JWT_SECRET=t - - LOG_LEVEL=trace - volumes: - - ./coverage:/project/coverage + app: + build: + context: . + target: production + dockerfile: Dockerfile + environment: + - NODE_ENV=production + - PORT=3000 + - DISCORD_CLIENT_ID=x + - DISCORD_CLIENT_SECRET=-x + - DISCORD_REDIRECT_URI=x + - GOOGLE_CLIENT_ID=x + - GOOGLE_CLIENT_SECRET=x + - GOOGLE_REDIRECT_URI=x + - SESSION_SECRET=x + - JWT_SECRET=x + - WALLET_PRIVATE_KEY=0x85167e00aeed1db6a59945f1f78f997856e2e312cf4e55cde90b740b71f9808c + - WALLET_PUBLIC_KEY=x + - LOG_LEVEL=info + - FRONTEND_URL=http://localhost:3000 + - LIT_NETWORK=datil-dev + volumes: + - ./coverage:/project/coverage diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 50f3f61..eae479a 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -1,21 +1,26 @@ -version: "3.9" +version: '3.9' services: - app: - build: - context: . - target: test - dockerfile: Dockerfile - environment: - - NODE_ENV=test - - PORT=3000 - - GOOGLE_CLIENT_ID=x - - GOOGLE_CLIENT_SECRET=y - - GOOGLE_CALLBACK_URI=https://github.com/brocoders/nestjs-boilerplate/tree/main/src - - DISCORD_CLIENT_ID=v - - DISCORD_CLIENT_SECRET=b - - DISCORD_CALLBACK_URI=https://github.com/brocoders/nestjs-boilerplate/tree/main/src - - JWT_SECRET=t - - LOG_LEVEL=trace - volumes: - - ./coverage:/project/coverage + app: + build: + context: . + target: test + dockerfile: Dockerfile + environment: + - NODE_ENV=test + - PORT=3000 + - DISCORD_CLIENT_ID=x + - DISCORD_CLIENT_SECRET=-x + - DISCORD_REDIRECT_URI=http://localhost:4000/api/v1/auth/discord/authenticate/callback + - GOOGLE_CLIENT_ID=x + - GOOGLE_CLIENT_SECRET=x + - GOOGLE_REDIRECT_URI=http://localhost:4000/api/v1/auth/google/authenticate/callback + - SESSION_SECRET=x + - JWT_SECRET=x + - WALLET_PRIVATE_KEY=0x85167e00aeed1db6a59945f1f78f997856e2e312cf4e55cde90b740b71f9808c + - WALLET_PUBLIC_KEY=x + - LOG_LEVEL=info + - FRONTEND_URL=http://localhost:3000 + - LIT_NETWORK=datil-dev + volumes: + - ./coverage:/project/coverage diff --git a/src/auth-discord/config/auth-discord.config.ts b/src/auth-discord/config/auth-discord.config.ts index 6ff201e..a304699 100644 --- a/src/auth-discord/config/auth-discord.config.ts +++ b/src/auth-discord/config/auth-discord.config.ts @@ -17,6 +17,7 @@ export const discordConfigSchema = { .required() .description('Discord client secret'), DISCORD_REDIRECT_URI: Joi.string() + .uri() .required() .description('Discord redirect URI after OAuth'), DISCORD_SCOPES: Joi.string() From b6ce3e537606ca75adfdde4fe99f721d0088bac3 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 12 Aug 2024 17:10:20 +0400 Subject: [PATCH 6/6] ci: fixing docker issues --- docker-compose.dev.yml | 2 +- docker-compose.prod.yml | 6 +++--- docker-compose.test.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index c02bf0e..7797bd0 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -17,7 +17,7 @@ services: - GOOGLE_REDIRECT_URI=http://localhost:4000/api/v1/auth/google/authenticate/callback - SESSION_SECRET=x - JWT_SECRET=x - - WALLET_PRIVATE_KEY=0x85167e00aeed1db6a59945f1f78f997856e2e312cf4e55cde90b740b71f9808c + - WALLET_PRIVATE_KEY=x - WALLET_PUBLIC_KEY=x - LOG_LEVEL=info - FRONTEND_URL=http://localhost:3000 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 9acf3e5..ccd40fc 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -10,14 +10,14 @@ services: - NODE_ENV=production - PORT=3000 - DISCORD_CLIENT_ID=x - - DISCORD_CLIENT_SECRET=-x + - DISCORD_CLIENT_SECRET=-http://localhost:4000/api/v1/auth/discord/authenticate/callback - DISCORD_REDIRECT_URI=x - GOOGLE_CLIENT_ID=x - GOOGLE_CLIENT_SECRET=x - - GOOGLE_REDIRECT_URI=x + - GOOGLE_REDIRECT_URI=http://localhost:4000/api/v1/auth/google/authenticate/callback - SESSION_SECRET=x - JWT_SECRET=x - - WALLET_PRIVATE_KEY=0x85167e00aeed1db6a59945f1f78f997856e2e312cf4e55cde90b740b71f9808c + - WALLET_PRIVATE_KEY=x - WALLET_PUBLIC_KEY=x - LOG_LEVEL=info - FRONTEND_URL=http://localhost:3000 diff --git a/docker-compose.test.yml b/docker-compose.test.yml index eae479a..e7702ec 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -17,7 +17,7 @@ services: - GOOGLE_REDIRECT_URI=http://localhost:4000/api/v1/auth/google/authenticate/callback - SESSION_SECRET=x - JWT_SECRET=x - - WALLET_PRIVATE_KEY=0x85167e00aeed1db6a59945f1f78f997856e2e312cf4e55cde90b740b71f9808c + - WALLET_PRIVATE_KEY=x - WALLET_PUBLIC_KEY=x - LOG_LEVEL=info - FRONTEND_URL=http://localhost:3000