refactor(windows): `windows-service` option support via config file
Diff
src/settings/cli.rs | 2 +-
src/settings/file.rs | 3 +++
src/settings/mod.rs | 13 +++++++++++--
src/winservice.rs | 2 +-
4 files changed, 16 insertions(+), 4 deletions(-)
@@ -190,7 +190,7 @@ pub struct General {
default_value = "false",
env = "SERVER_WINDOWS_SERVICE"
)]
pub windows_service: bool,
@@ -127,6 +127,9 @@ pub struct General {
pub page_fallback: Option<PathBuf>,
pub log_remote_address: Option<bool>,
#[cfg(windows)]
pub windows_service: Option<bool>,
}
@@ -84,6 +84,10 @@ impl Settings {
let mut page_fallback = opts.page_fallback;
let mut log_remote_address = opts.log_remote_address;
#[cfg(windows)]
let mut windows_service = opts.windows_service;
let mut settings_advanced: Option<Advanced> = None;
@@ -170,6 +174,12 @@ impl Settings {
if let Some(v) = general.log_remote_address {
log_remote_address = v
}
#[cfg(windows)]
if let Some(v) = general.windows_service {
windows_service = v
}
}
@@ -291,10 +301,9 @@ impl Settings {
page_fallback,
log_remote_address,
#[cfg(windows)]
windows_service: opts.windows_service,
windows_service,
#[cfg(windows)]
commands: opts.commands,
},
@@ -1,4 +1,4 @@
use std::ffi::OsString;
use std::thread;