Skip to content

Commit

Permalink
Revert prod configs
Browse files Browse the repository at this point in the history
  • Loading branch information
samchuk-vlad committed Jan 16, 2024
1 parent d0fcd83 commit 6395c39
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export const validatorsStakingNetworks = [
]

export const VALIDATOR_STAKING_REWARDS_API_KEY = 'f00511ab0c5e422796b8f5d9c7029fbe'
// export const ONFINALITY_API_KEY = 'e75486ad-bbb5-4b93-8699-3123f8dbabc5'
export const ONFINALITY_API_KEY = 'e75486ad-bbb5-4b93-8699-3123f8dbabc5'

export const ONFINALITY_API_KEY = '28209e0e-fc76-481e-a80f-745ffdf477d7' // test api key for localhost
// export const ONFINALITY_API_KEY = '28209e0e-fc76-481e-a80f-745ffdf477d7' // test api key for localhost


export const SUBSOCIAL_GRAPHQL_CLIENT = 'https://squid.subsquid.io/subsocial/graphql'
Expand Down
36 changes: 18 additions & 18 deletions src/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import express from 'express'
import cors from 'cors'
import timeout from 'connect-timeout'
import { reqTimeoutSecs, port } from './constant/env'
import { reqTimeoutSecs, port, allowedOrigins } from './constant/env'
import { newLogger } from '@subsocial/utils'

import { createRoutes } from './routes'
Expand All @@ -22,28 +22,28 @@ export const startHttpServer = (apis: Connections) => {

app.use(express.static('public'))

// app.use(
// cors((req, callback) => {
// const corsOptions = { origin: true }
// const origin = req.header('Origin')
// const isAllowedOrigin = allowedOrigins.some((allowedOrigin) =>
// origin?.includes(allowedOrigin)
// )
// if (!isAllowedOrigin) {
// corsOptions.origin = false
// }
// callback(null, corsOptions)
// })
// )

// For localhost testing
app.use(
cors((req, callback) => {
const origin = req.method === 'GET' ? '*' : '*'
callback(null, { origin })
const corsOptions = { origin: true }
const origin = req.header('Origin')
const isAllowedOrigin = allowedOrigins.some((allowedOrigin) =>
origin?.includes(allowedOrigin)
)
if (!isAllowedOrigin) {
corsOptions.origin = false
}
callback(null, corsOptions)
})
)

// For localhost testing
// app.use(
// cors((req, callback) => {
// const origin = req.method === 'GET' ? '*' : '*'
// callback(null, { origin })
// })
// )

function haltOnTimedout(req: express.Request, _res: express.Response, next) {
if (!req.timedout) next()
}
Expand Down

0 comments on commit 6395c39

Please sign in to comment.