Skip to content

Commit

Permalink
Use prod envs
Browse files Browse the repository at this point in the history
  • Loading branch information
samchuk-vlad committed Oct 25, 2023
1 parent 03d674d commit 203217d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
3 changes: 1 addition & 2 deletions src/connections/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { RelayChain } from '../../services/crowdloan/types'

export const subsocial = {
name: 'Subsocial',
node: 'https://rco-para.subsocial.network',
wsNode: 'wss://rco-para.subsocial.network',
node: 'wss://para.subsocial.network',
icon: 'subsocial-parachain.svg',
paraId: 2100,
ipfs: 'https://ipfs.subsocial.network',
Expand Down
4 changes: 2 additions & 2 deletions src/constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,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/* , allowedOrigins */, port } from './constant/env'
import { reqTimeoutSecs, allowedOrigins, port } from './constant/env'
import { newLogger } from '@subsocial/utils'

import { createRoutes } from './routes'
Expand All @@ -21,28 +21,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
4 changes: 2 additions & 2 deletions src/services/creatorStaking/creatorsSpaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { gql } from 'graphql-request'
import Cache from '../../cache'
import { ONE_HOUR } from '../../constant'
import { soonsocialGraphQlClient } from '../../constant/graphQlClients'
import { subsocialGraphQlClient } from '../../constant/graphQlClients'

const creatorsSpacesCache = new Cache('creators-spaces', ONE_HOUR)

Expand All @@ -27,7 +27,7 @@ export const GET_CREATORS_SPACES = gql`
`

export const getCreatorsSpacesInfo = async ({ spaceIds }: CreatorsSpacesInfo) => {
const result = await soonsocialGraphQlClient.request(GET_CREATORS_SPACES, { ids: spaceIds })
const result = await subsocialGraphQlClient.request(GET_CREATORS_SPACES, { ids: spaceIds })

if (!result) return []

Expand Down

0 comments on commit 203217d

Please sign in to comment.