fix: add network.interface validation

This commit is contained in:
Orion Kindel 2023-06-11 20:43:14 -05:00
parent 2169e4cfc1
commit 95fbc5167a
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719

View File

@ -56,13 +56,14 @@ const parseSegmentNetwork = flow(
new Error(["network required", `in: ${JSON.stringify(o)}`].join("\n"))
),
Either.flatMap((n) =>
"interface" in n
("interface" in n && n.interface === "public") || n.interface === "local"
? Either.right(n)
: Either.left(
new Error(
["network.interface required", `in: ${JSON.stringify(n)}`].join(
"\n"
)
[
"network.interface required, and must be 'public' or 'local'",
`in: ${JSON.stringify(n)}`,
].join("\n")
)
)
),