aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2025-07-23 10:56:10 +0200
committerGitHub <noreply@github.com>2025-07-23 10:56:10 +0200
commit25a684e0949a948db0b353626bdec98ea1229f9b (patch)
treeb46d82e466ed5ea1f950a5f85d88d0f40a9c1c6c /src
parentfix(status-bar): proper truncation of secondary info (#4313) (diff)
downloadsl0ppij-25a684e0949a948db0b353626bdec98ea1229f9b.tar.gz
sl0ppij-25a684e0949a948db0b353626bdec98ea1229f9b.tar.xz
sl0ppij-25a684e0949a948db0b353626bdec98ea1229f9b.zip
feat(web): allow specifying ip/port/cert/key through the cli (#4314)
* feat(web): allow specifying ip/port/cert/key through the cli * fix no-web
Diffstat (limited to 'src')
-rw-r--r--src/commands.rs31
-rw-r--r--src/main.rs9
2 files changed, 35 insertions, 5 deletions
diff --git a/src/commands.rs b/src/commands.rs
index 87f256d6..e25bce6d 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -1,4 +1,5 @@
use dialoguer::Confirm;
+use std::net::IpAddr;
use std::{fs::File, io::prelude::*, path::PathBuf, process, time::Duration};
#[cfg(feature = "web_server_capability")]
@@ -159,7 +160,14 @@ pub(crate) fn start_server(path: PathBuf, debug: bool) {
}
#[cfg(feature = "web_server_capability")]
-pub(crate) fn start_web_server(opts: CliArgs, run_daemonized: bool) {
+pub(crate) fn start_web_server(
+ opts: CliArgs,
+ run_daemonized: bool,
+ ip: Option<IpAddr>,
+ port: Option<u16>,
+ cert: Option<PathBuf>,
+ key: Option<PathBuf>,
+) {
// TODO: move this outside of this function
let (config, _layout, config_options, _config_without_layout, _config_options_without_layout) =
match Setup::from_cli_args(&opts) {
@@ -174,12 +182,27 @@ pub(crate) fn start_web_server(opts: CliArgs, run_daemonized: bool) {
process::exit(1);
},
};
-
- start_web_client_impl(config, config_options, opts.config, run_daemonized);
+ start_web_client_impl(
+ config,
+ config_options,
+ opts.config,
+ run_daemonized,
+ ip,
+ port,
+ cert,
+ key,
+ );
}
#[cfg(not(feature = "web_server_capability"))]
-pub(crate) fn start_web_server(_opts: CliArgs, _run_daemonized: bool) {
+pub(crate) fn start_web_server(
+ _opts: CliArgs,
+ _run_daemonized: bool,
+ _ip: Option<IpAddr>,
+ _port: Option<u16>,
+ _cert: Option<PathBuf>,
+ _key: Option<PathBuf>,
+) {
log::error!(
"This version of Zellij was compiled without web server support, cannot run web server!"
);
diff --git a/src/main.rs b/src/main.rs
index 4720a13a..a2f23162 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -231,7 +231,14 @@ fn main() {
} else if let Some(Command::Web(web_opts)) = &opts.command {
if web_opts.get_start() {
let daemonize = web_opts.daemonize;
- commands::start_web_server(opts, daemonize);
+ commands::start_web_server(
+ opts.clone(),
+ daemonize,
+ web_opts.ip,
+ web_opts.port,
+ web_opts.cert.clone(),
+ web_opts.key.clone(),
+ );
} else if web_opts.stop {
match commands::stop_web_server() {
Ok(()) => {