Skip to content

Commit

Permalink
Merge pull request #77 from srikanthlogic/dev
Browse files Browse the repository at this point in the history
Bug Fixes
  • Loading branch information
srikanthlogic authored Feb 4, 2024
2 parents 24ec0e2 + 475f0a5 commit b4718f1
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 2,214 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4

- name: Cache Node.js dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -30,7 +30,7 @@ jobs:
node-version: 18

- name: Install Dependencies
run: npm ci
run: npm install

- name: Generate OAS 3.0
run: npm run generateoas
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Cache Docker layers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }}
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

- name: Cache FlyCtl binary
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.fly
key: ${{ runner.os }}-flyctl
Expand Down
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
# Use the official Node.js image as base
FROM node:18-alpine
FROM node:18-alpine AS base

# Set metadata labels
LABEL maintainer="Srikanth <[email protected]>" \
version="1.5.0" \
description="Docker image for running Google Play API"

# Create and set the working directory
WORKDIR /home/node/app
WORKDIR /app

FROM base as build

# Copy only the package.json and package-lock.json first to leverage Docker caching
COPY package*.json ./
COPY --link package-lock.json package.json ./

RUN npm install -g npm@10.1.0
RUN npm install -g npm@10.3.0

# Install dependencies
RUN npm ci --quiet --omit=dev
RUN npm install

# Copy the rest of the application code
COPY . .
COPY --link . .

RUN npm run generateoas

RUN npm prune

FROM base
# Copy the rest of the application code
COPY --from=build /app /app

# Expose port 3000
EXPOSE 3000

Expand Down
2,186 changes: 0 additions & 2,186 deletions Postman Collections/GooglePlayAPI.postman_collection.json.json

This file was deleted.

10 changes: 5 additions & 5 deletions PostmanCollections/GooglePlayAPI.postman_collection.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions fly.production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ primary_region = "sin"

[http_service.concurrency]
type = "requests"
soft_limit = 400
hard_limit = 500
soft_limit = 800
hard_limit = 1000

[env]
COUNTRY_OF_QUERY = "IN"
Expand Down
4 changes: 2 additions & 2 deletions fly.staging.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ primary_region = "sin"

[http_service.concurrency]
type = "requests"
soft_limit = 400
hard_limit = 500
soft_limit = 800
hard_limit = 1000

[env]
COUNTRY_OF_QUERY = "IN"
Expand Down
9 changes: 6 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ router.use((req, res, next) => {
}

if (process.env.LOGGING || false) {
console.log("GPlayAPI", req.url, req.baseUrl, req.params)
console.log("GPlayAPI", req.url, req.baseUrl, req.params, "Status: ", res.statusCode)
}

next();
Expand Down Expand Up @@ -265,8 +265,11 @@ function anonymizeReplyText(replyText, userName) {
}

function errorHandler(err, req, res, next) {
res.status(400).json({ message: err.message });
next();
if (!res.headersSent) {
const status = err.message === "App not found (404)" ? 404 : 400;
res.status(status).json({ error: status === 404 ? "App not found" : "Bad Request", message: err.message, url: req.url });
}
next(err);
}

router.use(errorHandler);
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"eslint-plugin-standard": "^5.0.0",
"newman": "^6.1.0",
"newman-reporter-htmlextra": "^1.23.0",
"npm-check-updates": "^16.14.12"
"npm-check-updates": "^16.14.14"
}
}

0 comments on commit b4718f1

Please sign in to comment.