From a480e3b8f803e41a801f73dbc75e687bf2eab0f5 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Thu, 22 Jun 2023 16:32:01 -0700 Subject: [PATCH] properly parse multiaddress --- codex/conf.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/codex/conf.nim b/codex/conf.nim index 57ae29b2..7c94c44d 100644 --- a/codex/conf.nim +++ b/codex/conf.nim @@ -309,6 +309,16 @@ proc readValue*(r: var TomlReader, val: var SignedPeerRecord) = val = SignedPeerRecord.parseCmdArg(uri) +proc readValue*(r: var TomlReader, val: var MultiAddress) = + without maddr =? r.readValue(string).catch, err: + error "invalid MultiAddress value", error = err.msg + quit QuitFailure + + without val =? MultiAddress.init(maddr).catch, err: + error "invalid MultiAddress value", error = err.msg + quit QuitFailure + + # no idea why confutils needs this: proc completeCmdArg*(T: type EthAddress; val: string): seq[string] = discard