diff options
author | Alex <alex@adnab.me> | 2022-09-14 16:37:18 +0200 |
---|---|---|
committer | Alex <alex@adnab.me> | 2022-09-14 16:37:18 +0200 |
commit | 82600acf776acecfa73fbf23d4c7107eaae81e09 (patch) | |
tree | 19bb547df310c40ead34b14b6bad3c8e1d408397 /src/garage | |
parent | 80fdbfb0aa1b7186db3aeef888c0954748a35c62 (diff) | |
parent | e46dc2a8ef8a12e49aed3883b34b538b5f65ca31 (diff) | |
download | garage-82600acf776acecfa73fbf23d4c7107eaae81e09.tar.gz garage-82600acf776acecfa73fbf23d4c7107eaae81e09.zip |
Merge pull request 'Allow for hostnames in bootstrap_peers and rpc_public_addr (fix #353)' (#383) from resolve-peer-names into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/383
Diffstat (limited to 'src/garage')
-rw-r--r-- | src/garage/main.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/garage/main.rs b/src/garage/main.rs index 0eca24ae..e5cba553 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -162,7 +162,13 @@ async fn cli_command(opt: Opt) -> Result<(), Error> { } else { let node_id = garage_rpc::system::read_node_id(&config.as_ref().unwrap().metadata_dir) .err_context(READ_KEY_ERROR)?; - if let Some(a) = config.as_ref().and_then(|c| c.rpc_public_addr) { + if let Some(a) = config.as_ref().and_then(|c| c.rpc_public_addr.as_ref()) { + use std::net::ToSocketAddrs; + let a = a + .to_socket_addrs() + .ok_or_message("unable to resolve rpc_public_addr specified in config file")? + .next() + .ok_or_message("unable to resolve rpc_public_addr specified in config file")?; (node_id, a) } else { let default_addr = SocketAddr::new( |