Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ To follow these steps, ensure that your environment is configured to run Node.js
- `REDIS_URL`: connection string for redis
- `MONGO_URL`: connection string for mongodb
- `RAIL_URL`: url of the rail api
- `RAIL_API_KEY`: api key for the rail api
- `PROXY_URL`: url of the proxy service
- `APPLE_BUNDLE_ID`: bundle id of the iOS app to send notifications to
- `APPLE_TEAM_ID`: team id for the developer account associated with the iOS app
- `APPLE_KEY_ID`: apple notifications key id
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"express": "^4.18.2",
"express-rate-limit": "^6.7.0",
"firebase-admin": "^11.7.0",
"https-proxy-agent": "^7.0.6",
"lodash": "^4.17.21",
"node-schedule": "^2.1.1",
"redis": "^4.6.5",
Expand Down
2 changes: 2 additions & 0 deletions src/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const port = process.env.PORT || 3000
export const redisUrl = process.env.REDIS_URL as string
export const mongoUrl = process.env.MONGO_URL as string
export const railUrl = process.env.RAIL_URL as string
export const railApiKey = process.env.RAIL_API_KEY as string
export const proxyUrl = process.env.PROXY_URL as string
export const appleBundleId = process.env.APPLE_BUNDLE_ID as string
export const appleTeamId = process.env.APPLE_TEAM_ID as string
export const appleKeyId = process.env.APPLE_KEY_ID as string
Expand Down
8 changes: 6 additions & 2 deletions src/requests/rail-api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"

import http from "http"
import axiosRetry from "axios-retry"
import axios, { AxiosInstance } from "axios"
import { HttpsProxyAgent } from "https-proxy-agent"

import { railUrl } from "../data/config"
import { railUrl, proxyUrl, railApiKey } from "../data/config"

http.globalAgent.maxSockets = 100

Expand All @@ -13,9 +16,10 @@ export class RailApi {
this.axiosInstance = axios.create({
baseURL: railUrl,
timeout: 30000,
httpsAgent: proxyUrl && new HttpsProxyAgent(proxyUrl),
headers: {
Accept: "application/json",
"Ocp-Apim-Subscription-Key": "4b0d355121fe4e0bb3d86e902efe9f20",
"Ocp-Apim-Subscription-Key": railApiKey,
},
})

Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,11 @@ agent-base@6:
dependencies:
debug "4"

agent-base@^7.1.2:
version "7.1.4"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.4.tgz#e3cd76d4c548ee895d3c3fd8dc1f6c5b9032e7a8"
integrity sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==

ansi-escapes@^4.2.1:
version "4.3.2"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e"
Expand Down Expand Up @@ -2322,6 +2327,14 @@ https-proxy-agent@^5.0.0:
agent-base "6"
debug "4"

https-proxy-agent@^7.0.6:
version "7.0.6"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9"
integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==
dependencies:
agent-base "^7.1.2"
debug "4"

human-signals@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"
Expand Down