Skip to content

Commit

Permalink
upgrade docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
janishar committed Jan 5, 2024
1 parent ca62bb4 commit 13fb2d5
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Here we are getting our node as Base image
FROM node:18.12.1
FROM node:20.10.0

# create user in the docker image
USER node
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
* Install Docker and Docker Compose. [Find Instructions Here](https://docs.docker.com/install/).
* Execute `docker-compose up -d` in terminal from the repo directory.
* You will be able to access the api from http://localhost:3000
* Run Tests: `docker exec -t app npm test`
* *If having any issue* then make sure 3000 port is not occupied else provide a different port in **.env** file.
* *If having any issue* then make sure 27017 port is not occupied else provide a different port in **.env** file.
* Run The Tests
Expand Down Expand Up @@ -346,7 +347,7 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp

### License
```
Copyright (C) 2023 JANISHAR ALI ANWAR
Copyright (C) 2024 JANISHAR ALI ANWAR

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:

mongo:
# To create this service, Compose will pull the mongo
image: mongo:6.0.3
image: mongo:7.0.4
container_name: mongo
restart: unless-stopped
# This tells Compose that we would like to add environment variables
Expand All @@ -50,7 +50,7 @@ services:
- dbdata:/data/db

redis:
image: redis:7.0.5
image: redis:7.2.3
container_name: redis
restart: unless-stopped
env_file: .env
Expand Down
2 changes: 0 additions & 2 deletions src/auth/apikey.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import express from 'express';
import ApiKeyRepo from '../database/repository/ApiKeyRepo';
import { ForbiddenError } from '../core/ApiError';
import Logger from '../core/Logger';
import { PublicRequest } from 'app-request';
import schema from './schema';
import validator, { ValidationSource } from '../helpers/validator';
Expand All @@ -18,7 +17,6 @@ export default router.use(

const apiKey = await ApiKeyRepo.findByKey(key);
if (!apiKey) throw new ForbiddenError();
Logger.info(apiKey);

req.apiKey = apiKey;
return next();
Expand Down
3 changes: 0 additions & 3 deletions src/core/JWT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { readFile } from 'fs';
import { promisify } from 'util';
import { sign, verify } from 'jsonwebtoken';
import { InternalError, BadTokenError, TokenExpiredError } from './ApiError';
import Logger from './Logger';

/*
* issuer  — Software organization who issues the token.
Expand Down Expand Up @@ -67,7 +66,6 @@ async function validate(token: string): Promise<JwtPayload> {
// @ts-ignore
return (await promisify(verify)(token, cert)) as JwtPayload;
} catch (e: any) {
Logger.debug(e);
if (e && e.name === 'TokenExpiredError') throw new TokenExpiredError();
// throws error if the token has not been encrypted by the private key
throw new BadTokenError();
Expand All @@ -85,7 +83,6 @@ async function decode(token: string): Promise<JwtPayload> {
ignoreExpiration: true,
})) as JwtPayload;
} catch (e) {
Logger.debug(e);
throw new BadTokenError();
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/helpers/validator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Joi from 'joi';
import { Request, Response, NextFunction } from 'express';
import Logger from '../core/Logger';
import { BadRequestError } from '../core/ApiError';
import { Types } from 'mongoose';

Expand Down Expand Up @@ -44,7 +43,6 @@ export default (
const message = details
.map((i) => i.message.replace(/['"]+/g, ''))
.join(',');
Logger.info(message);

next(new BadRequestError(message));
} catch (error) {
Expand Down
9 changes: 5 additions & 4 deletions tests/.env.test.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ DB_NAME=blogs-test-db
DB_MIN_POOL_SIZE=2
DB_MAX_POOL_SIZE=5

#localhost or IP of the server
# YOUR_TEST_MONGO_DB_HOST_NAME
DB_HOST=localhost
# DB_HOST=mongo
# localhost or IP of the server
# If using the docker installation then use 'mongo' for host name else localhost or ip or db server
# YOUR_MONGO_DB_HOST_NAME
# DB_HOST=localhost
DB_HOST=mongo

DB_PORT=27017

Expand Down

0 comments on commit 13fb2d5

Please sign in to comment.