appmgr: feature flag for avahi

This commit is contained in:
Aiden McClelland
2021-02-26 11:24:44 -07:00
committed by Aiden McClelland
parent 218bae3b46
commit 1c8889a60c
3 changed files with 20 additions and 15 deletions

View File

@@ -13,13 +13,14 @@ name = "appmgr"
path = "src/main.rs"
[features]
default = []
avahi = ["avahi-sys"]
default = ["avahi"]
portable = []
production = []
[dependencies]
async-trait = "0.1.42"
avahi-sys = { git = "https://github.com/Start9Labs/avahi-sys", branch = "feature/dynamic-linking", features = ["dynamic"] }
avahi-sys = { git = "https://github.com/Start9Labs/avahi-sys", branch = "feature/dynamic-linking", features = ["dynamic"], optional = true }
base32 = "0.4.0"
clap = "2.33"
ctrlc = "3.1.7"

View File

@@ -31,6 +31,7 @@ pub mod error;
pub mod index;
pub mod inspect;
pub mod install;
#[cfg(feature = "avahi")]
pub mod lan;
pub mod logs;
pub mod manifest;

View File

@@ -162,6 +162,21 @@ async fn inner_main() -> Result<(), Error> {
),
);
#[cfg(feature = "avahi")]
let app = app.subcommand(
SubCommand::with_name("lan")
.about("Configures LAN services")
.subcommand(
SubCommand::with_name("enable")
.about("Publishes the LAN address for the service over avahi")
.arg(
Arg::with_name("ID")
.help("ID of the application to publish the LAN address for")
.required(true),
),
),
);
#[cfg(not(feature = "portable"))]
let mut app = app
.subcommand(
@@ -448,19 +463,6 @@ async fn inner_main() -> Result<(), Error> {
)
.subcommand(SubCommand::with_name("reload").about("Reloads the tor configuration")),
)
.subcommand(
SubCommand::with_name("lan")
.about("Configures LAN services")
.subcommand(
SubCommand::with_name("enable")
.about("Publishes the LAN address for the service over avahi")
.arg(
Arg::with_name("ID")
.help("ID of the application to publish the LAN address for")
.required(true),
),
),
)
.subcommand(
SubCommand::with_name("info")
.about("Prints information about an installed app")
@@ -1200,6 +1202,7 @@ async fn inner_main() -> Result<(), Error> {
std::process::exit(1);
}
},
#[cfg(feature = "avahi")]
#[cfg(not(feature = "portable"))]
("lan", Some(sub_m)) => match sub_m.subcommand() {
("enable", Some(sub_sub_m)) => {