diff --git a/app/src/index.ts b/app/src/index.ts index 345f083..67eca67 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -3,7 +3,7 @@ import * as Ads from './ads'; import server from './server'; dotenv.config(); -const PORT = process.env.PORT || 1228; +const { PORT = 1228 } = process.env; Ads.startup(); diff --git a/app/src/server/index.ts b/app/src/server/index.ts index e6b60e8..5d0bde0 100644 --- a/app/src/server/index.ts +++ b/app/src/server/index.ts @@ -5,13 +5,15 @@ import { Server } from 'socket.io'; import { logger } from '../logger'; import setRoutes from './routes'; +const { CORS = 'http://localhost:1227' } = process.env; + const app = express(); const http = createServer(app); export const io = new Server(http, { - cors: { origin: process.env.CORS || 'http://localhost:1227' } + cors: { origin: CORS } }); -app.use(cors({ origin: process.env.CORS || 'http://localhost:1227' })); +app.use(cors({ origin: CORS })); setRoutes(app); diff --git a/app/src/steam/currency.ts b/app/src/steam/currency.ts index 5db91ba..4a507de 100644 --- a/app/src/steam/currency.ts +++ b/app/src/steam/currency.ts @@ -23,7 +23,7 @@ function replaceInvalid(str: string) { function currency( name: string, currencyId: number, - /* [index at pos 0, index at last pos] */ [a, b]: number[] + [a, b]: [number, number] ): ICurrency { return { name, @@ -33,7 +33,7 @@ function currency( } export function getCurrency(id: number): ICurrency { - for (let obj of Object.keys(CURRENCIES)) { + for (let obj of Object.keys(CURRENCIES) as (keyof typeof CURRENCIES)[]) { const currency: ICurrency = CURRENCIES[obj]; if (currency.currencyId === id) { return currency;