mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-12 19:56:48 +00:00
fix: Don't require resolv.conf when dns_servers is configured
This commit is contained in:
1 parent
fca19a983d
commit
9be45212f1
3 files changed
+13
-3
No files matched your search
@@ -0,0 +1 @@
|
||||
Fix the DNS resolver failing to start without `/etc/resolv.conf` when `dns_servers` is configured. Contributed by @eleboucher.
|
||||
@@ -338,8 +338,16 @@ fn builder_interface(
|
||||
fn get_dns_resolver(server: &Arc<Server>) -> Result<Arc<TokioResolver>> {
|
||||
let config = &server.config;
|
||||
|
||||
let (system_resolver_config, mut opts) = hickory_resolver::system_conf::read_system_conf()
|
||||
.map_err(|e| err!(error!("Failed to configure DNS resolver from system: {e}")))?;
|
||||
let (system_resolver_config, mut opts) =
|
||||
match hickory_resolver::system_conf::read_system_conf() {
|
||||
| Ok(system_conf) => system_conf,
|
||||
| Err(e) if config.dns_servers.is_empty() =>
|
||||
return Err(err!(error!("Failed to configure DNS resolver from system: {e}"))),
|
||||
| Err(e) => {
|
||||
warn!("Failed to read system DNS configuration, using dns_servers: {e}");
|
||||
Default::default()
|
||||
},
|
||||
};
|
||||
|
||||
let mut conf = ResolverConfig::from_name_servers(vec![]);
|
||||
|
||||
|
||||
@@ -222,7 +222,8 @@ async fn test_services() -> (Arc<crate::Services>, std::path::PathBuf) {
|
||||
"database_path": path,
|
||||
"db_cache_capacity_mb": 16.0,
|
||||
"rocksdb_write_buffer_capacity_mb": 4.0,
|
||||
"allow_local_presence": false
|
||||
"allow_local_presence": false,
|
||||
"dns_servers": ["127.0.0.1"]
|
||||
}))
|
||||
.unwrap();
|
||||
let runtime = tokio::runtime::Handle::current();
|
||||
|
||||
Reference in new issue
Block a user