Skip to content

Commit

Permalink
update cli flags
Browse files Browse the repository at this point in the history
  • Loading branch information
munna0908 authored and marcinczenko committed Dec 19, 2024
1 parent 348e613 commit a8487ff
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions codex/conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ import ./logutils
import ./stores
import ./units
import ./utils
import ./nat
from ./validationconfig import MaxSlots, ValidationGroups

export units, net, codextypes, logutils
export units, net, codextypes, logutils,completeCmdArg,parseCmdArg,NatConfig
export ValidationGroups, MaxSlots

export
Expand Down Expand Up @@ -139,19 +140,13 @@ type
name: "listen-addrs" }: seq[MultiAddress]

# TODO: change this once we integrate nat support

nat* {.
desc: "IP Addresses to announce behind a NAT"
defaultValue: ValidIpAddress.init("127.0.0.1")
defaultValueDesc: "127.0.0.1"
abbr: "a"
name: "nat" }: ValidIpAddress

discoveryIp* {.
desc: "Discovery listen address"
defaultValue: ValidIpAddress.init(IPv4_any())
defaultValueDesc: "0.0.0.0"
abbr: "e"
name: "disc-ip" }: ValidIpAddress
desc: "Specify method to use for determining public address. " &
"Must be one of: any, none, upnp, pmp, extip:<IP>"
defaultValue: NatConfig(hasExtIp: false, nat: NatAny)
defaultValueDesc: "any"
name: "nat" }: NatConfig

discoveryPort* {.
desc: "Discovery (UDP) port"
Expand Down Expand Up @@ -527,6 +522,12 @@ proc readValue*(r: var TomlReader, val: var Duration)
quit QuitFailure
val = dur

proc readValue*(r: var TomlReader, val: var NatConfig)
{.raises: [SerializationError].} =
val = try: parseCmdArg(NatConfig, r.readValue(string))
except CatchableError as err:
raise newException(SerializationError, err.msg)

# no idea why confutils needs this:
proc completeCmdArg*(T: type EthAddress; val: string): seq[string] =
discard
Expand Down

0 comments on commit a8487ff

Please sign in to comment.