Skip to content

Commit

Permalink
Add --system and --session
Browse files Browse the repository at this point in the history
  • Loading branch information
elmarco committed Jul 4, 2023
1 parent f8678b3 commit 81d493d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/bin/busd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ struct ConfigArg {
/// The configuration file.
#[clap(long, value_parser)]
config_file: Option<String>,

/// Use the standard configuration file for the per-login-session message bus.
#[clap(long, value_parser)]
session: bool,

/// Use the standard configuration file for the system-wide message bus.
#[clap(long, value_parser)]
system: bool,
}

#[derive(Copy, Clone, Debug, ValueEnum)]
Expand Down Expand Up @@ -81,7 +89,19 @@ impl From<AuthMechanism> for zbus::AuthMechanism {
async fn main() -> Result<()> {
busd::tracing_subscriber::init();

let args = BusdArgs::parse();
let mut args = BusdArgs::parse();

// let's make --session the default
if !args.config.session && !args.config.system && args.config.config_file.is_none() {
args.config.session = true;
}
// FIXME: make default config configurable or OS dependant
if args.config.session {
args.config.config_file = Some("/usr/share/dbus-1/session.conf".into());
}
if args.config.system {
args.config.config_file = Some("/usr/share/dbus-1/system.conf".into());
}

let mut config = BusConfig::default();
if let Some(file) = args.config.config_file {
Expand Down

0 comments on commit 81d493d

Please sign in to comment.