This commit is contained in:
lda
2026-04-13 00:35:42 +07:00 Unverified
parent 1bbbe1615e
commit c4d7c51f7e
4 changed files with 24 additions and 19 deletions
+9 -10
View File
@@ -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,13 +50,14 @@ 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 {
anyhow::bail!(
"config {} already exists; re-run with --force to overwrite",
config.display()
);
}
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 {
+8 -7
View File
@@ -11,13 +11,14 @@ 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 {
anyhow::bail!(
"config {} already exists; re-run with --force to overwrite",
config_file.display()
);
}
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(|| {
+3 -1
View File
@@ -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),
+4 -1
View File
@@ -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(())
}