mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-22 12:30:08 +00:00
Support downloading SSZ genesis files with curl
This commit is contained in:
parent
5152c42c8e
commit
b56c96a4fd
@ -59,11 +59,13 @@ template `//`(url, fragment: string): string =
|
|||||||
url & "/" & fragment
|
url & "/" & fragment
|
||||||
|
|
||||||
proc downloadFile(url: string): Future[string] {.async.} =
|
proc downloadFile(url: string): Future[string] {.async.} =
|
||||||
let cmd = "curl --fail " & url
|
# TODO We need a proper HTTP client able to perform HTTPS downloads
|
||||||
|
let tempFile = getTempDir() / "nimbus.download"
|
||||||
|
let cmd = "curl --fail -o " & quoteShell(tempFile) & " " & url
|
||||||
let (fileContents, errorCode) = execCmdEx(cmd, options = {poUsePath})
|
let (fileContents, errorCode) = execCmdEx(cmd, options = {poUsePath})
|
||||||
if errorCode != 0:
|
if errorCode != 0:
|
||||||
raise newException(IOError, "Failed external command: '" & cmd & "', exit code: " & $errorCode & ", output: '" & fileContents & "'")
|
raise newException(IOError, "Failed external command: '" & cmd & "', exit code: " & $errorCode & ", output: '" & fileContents & "'")
|
||||||
return fileContents
|
return readFile(tempFile)
|
||||||
|
|
||||||
proc updateTestnetMetadata(conf: BeaconNodeConf): Future[NetworkMetadata] {.async.} =
|
proc updateTestnetMetadata(conf: BeaconNodeConf): Future[NetworkMetadata] {.async.} =
|
||||||
let metadataUrl = testnetsBaseUrl // $conf.network // networkMetadataFile
|
let metadataUrl = testnetsBaseUrl // $conf.network // networkMetadataFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user