Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mvadari committed Dec 2, 2024
1 parent bd65522 commit 63b351d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
9 changes: 5 additions & 4 deletions server/lib/rippled.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ const RIPPLEDS = []
process.env.VITE_RIPPLED_HOST?.split(',').forEach((host) => {
if (host?.includes(':')) {
RIPPLEDS.push(`wss://${host}`)
} else {
} else if (process.env.VITE_RIPPLED_WS_PORT) {
RIPPLEDS.push(`wss://${host}:${process.env.VITE_RIPPLED_WS_PORT}`)
if (!['', '443', undefined].includes(process.env.VITE_RIPPLED_WS_PORT)) {
RIPPLEDS.push(`wss://${host}:443`)
}
} else {
RIPPLEDS.push(`wss://${host}`)
}
})

console.log(RIPPLEDS)

const RIPPLED_CLIENT = new XrplClient(RIPPLEDS, { tryAllNodes: true })
// If there is a separate peer to peer server for admin requests, use it. Otherwise use the default url for everything.
const HAS_P2P_SOCKET =
Expand Down
7 changes: 5 additions & 2 deletions server/routes/v1/tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ async function fetchXRPLMetaTokens(offset) {
},
)
.then((resp) => resp.data)
.catch((e) => log.error(e))
.catch((e) => {
log.error(e)
return { count: 0 }
})
}

async function cacheXRPLMetaTokens() {
let offset = 0
let tokensDataBatch = []
let tokensDataBatch = {}
const allTokensFetched = []

tokensDataBatch = await fetchXRPLMetaTokens(0)
Expand Down
8 changes: 5 additions & 3 deletions src/containers/shared/SocketContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ function getSocket(rippledUrl?: string): ExplorerXrplClient {

if (host?.includes(':')) {
wsUrls.push(`${prefix}://${host}`)
} else {
} else if (process.env.VITE_RIPPLED_WS_PORT) {
wsUrls.push(`${prefix}://${host}:${process.env.VITE_RIPPLED_WS_PORT}`)
if (!['', '443', undefined].includes(process.env.VITE_RIPPLED_WS_PORT)) {
wsUrls.push(`${prefix}://${host}:443`)
if (process.env.VITE_ENVIRONMENT === 'custom') {
wsUrls.push(`${prefix}://${host}`)
}
} else {
wsUrls.push(`${prefix}://${host}`)
}
})

Expand Down

0 comments on commit 63b351d

Please sign in to comment.