diff options
author | Trinity Pointard <trinity.pointard@gmail.com> | 2021-03-18 19:46:35 +0100 |
---|---|---|
committer | Trinity Pointard <trinity.pointard@gmail.com> | 2021-03-18 19:47:51 +0100 |
commit | c8a7ce5cdf8deb376752588ba1fd99675d8587e7 (patch) | |
tree | 6121350f36d8ebb7a0622ef1c13fa949ecbad7b1 | |
parent | 81e9db783fd7f104ad3d15d60436a8767172e0df (diff) | |
download | garage-c8a7ce5cdf8deb376752588ba1fd99675d8587e7.tar.gz garage-c8a7ce5cdf8deb376752588ba1fd99675d8587e7.zip |
remove domain resolution for *_bind_addr
-rw-r--r-- | src/util/config.rs | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/util/config.rs b/src/util/config.rs index 313692fc..6b449459 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -11,7 +11,6 @@ pub struct Config { pub metadata_dir: PathBuf, pub data_dir: PathBuf, - #[serde(deserialize_with = "deserialize_addr")] pub rpc_bind_addr: SocketAddr, #[serde(deserialize_with = "deserialize_vec_addr")] @@ -50,14 +49,12 @@ pub struct TlsConfig { #[derive(Deserialize, Debug, Clone)] pub struct ApiConfig { - #[serde(deserialize_with = "deserialize_addr")] pub api_bind_addr: SocketAddr, pub s3_region: String, } #[derive(Deserialize, Debug, Clone)] pub struct WebConfig { - #[serde(deserialize_with = "deserialize_addr")] pub bind_addr: SocketAddr, pub root_domain: String, pub index: String, @@ -87,19 +84,6 @@ pub fn read_config(config_file: PathBuf) -> Result<Config, Error> { Ok(toml::from_str(&config)?) } -fn deserialize_addr<'de, D>(deserializer: D) -> Result<SocketAddr, D::Error> -where - D: de::Deserializer<'de>, -{ - use std::net::ToSocketAddrs; - - <&str>::deserialize(deserializer)? - .to_socket_addrs() - .map_err(|_| de::Error::custom("could not resolve to a socket address"))? - .next() - .ok_or(de::Error::custom("could not resolve to a socket address")) -} - fn deserialize_vec_addr<'de, D>(deserializer: D) -> Result<Vec<SocketAddr>, D::Error> where D: de::Deserializer<'de>, |