fix config file test due to toml-serialization changes

This commit is contained in:
jangko 2022-09-23 08:49:00 +07:00
parent b098d9ea85
commit a26bfab7e5
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 9 additions and 3 deletions

View File

@ -21,7 +21,7 @@ proc writeValue*(w: var EnvvarWriter, value: auto) =
elif value is (SomePrimitives or range):
let key = constructKey(w.prefix, w.key)
setValue(key, value)
elif value is Option:
if value.isSome:
w.writeValue value.get

View File

@ -149,13 +149,19 @@ proc readValue(r: var TomlReader,
value = T r.parseAsString()
proc readValue(r: var TomlReader, value: var ValidIpAddress) =
value = ValidIpAddress.init(r.parseAsString())
try:
value = ValidIpAddress.init(r.parseAsString())
except ValueError as ex:
raise newException(SerializationError, ex.msg)
proc readValue(r: var TomlReader, value: var Port) =
value = r.parseInt(int).Port
proc readValue(r: var TomlReader, value: var GraffitiBytes) =
value = hexToByteArray[value.len](r.parseAsString())
try:
value = hexToByteArray[value.len](r.parseAsString())
except ValueError as ex:
raise newException(SerializationError, ex.msg)
proc readValue(r: var EnvvarReader,
value: var (InputFile | InputDir | OutFile | OutDir | ValidatorKeyPath)) =