28 lines
705 B
Rust
28 lines
705 B
Rust
use either::{Either, Either::Left};
|
|
use serde::Deserialize;
|
|
|
|
#[derive(Deserialize, Clone, Debug)]
|
|
pub struct CommandConfig {
|
|
/// The port(s) to listen on.
|
|
///
|
|
/// If you are using Docker, don't change this, you'll need to map an
|
|
/// external port to this.
|
|
///
|
|
/// To listen on multiple ports, specify a vector e.g. [8080, 8448]
|
|
///
|
|
/// default: 8008
|
|
#[serde(default = "default_port")]
|
|
pub port: ListeningPort,
|
|
}
|
|
|
|
#[derive(Deserialize, Clone, Debug)]
|
|
#[serde(transparent)]
|
|
pub struct ListeningPort {
|
|
#[serde(with = "either::serde_untagged")]
|
|
pub ports: Either<u16, Vec<u16>>,
|
|
}
|
|
|
|
fn default_port() -> ListeningPort {
|
|
ListeningPort { ports: Left(8008) }
|
|
}
|