fmt
This commit is contained in:
@@ -35,9 +35,7 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
Command::InitConfig(args) => {
|
||||
init_config(args)?
|
||||
}
|
||||
Command::InitConfig(args) => init_config(args)?,
|
||||
Command::Reload(args) => {
|
||||
::tracing::info!(pid_file = %args.pid_file.display(), "wakey-agent command: reload");
|
||||
serve::reload_daemon(&args.pid_file)?
|
||||
@@ -52,14 +50,15 @@ fn init_config(args: InitConfigArgs) -> Result<()> {
|
||||
anyhow::bail!("--stdout cannot be used with --config");
|
||||
}
|
||||
|
||||
if let Some(config) = &args.config {
|
||||
if config.exists() && !args.force {
|
||||
if let Some(config) = &args.config
|
||||
&& config.exists()
|
||||
&& !args.force
|
||||
{
|
||||
anyhow::bail!(
|
||||
"config {} already exists; re-run with --force to overwrite",
|
||||
config.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let cfg = config::AgentConfig {
|
||||
server_url: args
|
||||
|
||||
@@ -11,14 +11,15 @@ pub fn write_init_config(args: &InitConfigArgs) -> Result<Option<PathBuf>> {
|
||||
anyhow::bail!("--stdout cannot be used with --config-file");
|
||||
}
|
||||
|
||||
if let Some(config_file) = &args.config_file {
|
||||
if config_file.exists() && !args.force {
|
||||
if let Some(config_file) = &args.config_file
|
||||
&& config_file.exists()
|
||||
&& !args.force
|
||||
{
|
||||
anyhow::bail!(
|
||||
"config {} already exists; re-run with --force to overwrite",
|
||||
config_file.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let bind = args.bind.unwrap_or_else(|| {
|
||||
"0.0.0.0:8080"
|
||||
|
||||
@@ -190,7 +190,9 @@ fn resolve_admin_public_url(
|
||||
) -> Result<Option<String>> {
|
||||
match (mode.live, mode.offline) {
|
||||
(true, false) => config_public_url
|
||||
.ok_or_else(|| anyhow::anyhow!("--live requires --public-url or a configured public_url"))
|
||||
.ok_or_else(|| {
|
||||
anyhow::anyhow!("--live requires --public-url or a configured public_url")
|
||||
})
|
||||
.map(Some),
|
||||
(false, true) => Ok(None),
|
||||
_ => Ok(config_public_url),
|
||||
|
||||
@@ -32,7 +32,10 @@ async fn main() -> Result<()> {
|
||||
Command::InitConfig(args) => {
|
||||
if let Some(path) = config::write_init_config(&args)? {
|
||||
println!("config={}", path.display());
|
||||
println!("next=wakey-control-plane serve --config-file {}", path.display());
|
||||
println!(
|
||||
"next=wakey-control-plane serve --config-file {}",
|
||||
path.display()
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user