aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.toml.example1
-rw-r--r--src/bot/master.rs2
-rw-r--r--src/main.rs15
3 files changed, 12 insertions, 6 deletions
diff --git a/config.toml.example b/config.toml.example
index da39200..9f69d86 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -10,6 +10,7 @@ address = "localhost"
channel = "Lobby"
# Web server settings
+webserver_enable = true
domain = "localhost"
bind_address = "127.0.0.1:45538"
diff --git a/src/bot/master.rs b/src/bot/master.rs
index 94332ac..2885dfe 100644
--- a/src/bot/master.rs
+++ b/src/bot/master.rs
@@ -36,6 +36,7 @@ pub struct MasterArgs {
pub verbose: u8,
pub domain: String,
pub bind_address: String,
+ pub webserver_enable: bool,
pub names: Vec<String>,
pub id: Option<Identity>,
pub ids: Option<Vec<Identity>>,
@@ -345,6 +346,7 @@ impl MasterArgs {
address,
domain: self.domain,
bind_address: self.bind_address,
+ webserver_enable: self.webserver_enable,
id: self.id,
channel,
verbose,
diff --git a/src/main.rs b/src/main.rs
index 51b1e38..c7ad805 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -184,18 +184,21 @@ async fn run(root_logger: Logger) -> Result<(), Box<dyn std::error::Error>> {
ctrl_c.await??;
} else {
+ let webserver_enable = bot_args.webserver_enable;
let domain = bot_args.domain.clone();
let bind_address = bot_args.bind_address.clone();
let bot_name = bot_args.master_name.clone();
let bot_logger = root_logger.new(o!("master" => bot_name.clone()));
let bot = MasterBot::spawn(bot_args, bot_logger).await;
- let web_args = web_server::WebServerArgs {
- domain,
- bind_address,
- bot: bot.downgrade(),
- };
- spawn_web_server(web_args, root_logger.new(o!("webserver" => bot_name)));
+ if webserver_enable {
+ let web_args = web_server::WebServerArgs {
+ domain,
+ bind_address,
+ bot: bot.downgrade(),
+ };
+ spawn_web_server(web_args, root_logger.new(o!("webserver" => bot_name)));
+ }
#[cfg(unix)]
tokio::select! {