diff options
author | Alex Auvolat <alex@adnab.me> | 2022-03-10 10:51:40 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-03-14 10:54:25 +0100 |
commit | 9b2b531f4d8d62897b0dc3f8691608a9298a2f85 (patch) | |
tree | d50f7e9cf71427132caee12c00b0beebc2964523 /src/garage | |
parent | a19341b1885b87ab2ac0ee6fa8c19ba2fca5e3fc (diff) | |
download | garage-9b2b531f4d8d62897b0dc3f8691608a9298a2f85.tar.gz garage-9b2b531f4d8d62897b0dc3f8691608a9298a2f85.zip |
Make admin server optional
Diffstat (limited to 'src/garage')
-rw-r--r-- | src/garage/server.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/garage/server.rs b/src/garage/server.rs index 1e276e9e..37c3535e 100644 --- a/src/garage/server.rs +++ b/src/garage/server.rs @@ -68,10 +68,14 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> { wait_from(watch_cancel.clone()), )); - info!("Configure and run admin web server..."); - let admin_server = tokio::spawn( - admin_server_init.run(config.admin.api_bind_addr, wait_from(watch_cancel.clone())), - ); + let admin_server = if let Some(admin_bind_addr) = config.admin.api_bind_addr { + info!("Configure and run admin web server..."); + Some(tokio::spawn( + admin_server_init.run(admin_bind_addr, wait_from(watch_cancel.clone())), + )) + } else { + None + }; // Stuff runs @@ -82,8 +86,10 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> { if let Err(e) = web_server.await? { warn!("Web server exited with error: {}", e); } - if let Err(e) = admin_server.await? { - warn!("Admin web server exited with error: {}", e); + if let Some(a) = admin_server { + if let Err(e) = a.await? { + warn!("Admin web server exited with error: {}", e); + } } // Remove RPC handlers for system to break reference cycles |