Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
fix: use os.arch() when arch is undefined (#488)
Browse files Browse the repository at this point in the history
fixes #487
  • Loading branch information
SgtPooki authored Sep 7, 2022
1 parent 2288d77 commit f0cf7d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/setup-libp2p-relay-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ async function getDownloadURL (version, platform, arch, distUrl) {
const data = await got(`${distUrl}/libp2p-relay-daemon/${version}/dist.json`).json()

if (!data.platforms[platform]) {
throw new Error(`No binary available for platform '${platform}'`)
throw new Error(`No binary available for platform '${platform}'. Available platforms: ${Object.keys(data.platforms).join(', ')}`)
}

if (!data.platforms[platform].archs[arch]) {
throw new Error(`No binary available for platform '${platform}' and arch '${arch}'`)
throw new Error(`No binary available for platform '${platform}' and arch '${arch}'. Available architectures: ${Object.keys(data.platforms[platform].archs)}`)
}

const link = data.platforms[platform].archs[arch].link
Expand Down Expand Up @@ -148,8 +148,8 @@ async function download ({ version, platform, arch, installPath, distUrl }) {

download({
version: LIBP2P_RELAY_DAEMON_VERSION,
platform: process.env.TARGET_OS || goenv.GOOS,
arch: process.env.TARGET_ARCH || goenv.GOARCH,
platform: process.env.TARGET_OS || goenv.GOOS || os.platform(),
arch: process.env.TARGET_ARCH || goenv.GOARCH || os.arch(),
distUrl: process.env.GO_IPFS_DIST_URL || 'https://dist.ipfs.io',
installPath: path.resolve('scripts')
})
Expand Down

0 comments on commit f0cf7d8

Please sign in to comment.