Skip to content

Commit

Permalink
feat: configurable bee url (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomicvladan committed Aug 21, 2023
1 parent 4304646 commit 32e5d30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/fdp-storage/fdp-storage.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export abstract class FdpStorageProvider {
beeApiUrl: string
beeDebugApiUrl: string
}> {
let beeApiUrl = 'http://localhost:1633',
let beeApiUrl = swarm.swarmUrl || 'http://localhost:1633',
beeDebugApiUrl = 'http://localhost:1635'

if (process.env.CI_TESTS === 'true') {
Expand All @@ -65,6 +65,10 @@ export abstract class FdpStorageProvider {
}
}

if (!swarm.extensionEnabled) {
return { beeApiUrl, beeDebugApiUrl: null }
}

try {
const swarmExtension = new SwarmExtension(swarm.extensionId)
const beeAddresses = await swarmExtension.beeAddress()
Expand Down
4 changes: 4 additions & 0 deletions src/utils/bee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { NULL_BATCH_ID } from '../constants/constants'
*/
export async function getBatchId(beeDebugUrl: string): Promise<string> {
try {
if (!beeDebugUrl) {
return NULL_BATCH_ID
}

const beeDebug = new BeeDebug(beeDebugUrl)

const batches = await beeDebug.getAllPostageBatch()
Expand Down

0 comments on commit 32e5d30

Please sign in to comment.