Skip to content

Commit 2d41742

Browse files
authored
Implement configcheck (#490)
1 parent d68191b commit 2d41742

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

pgdog/src/cli.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,7 @@ pub enum Commands {
5656
},
5757

5858
/// Check configuration files for errors.
59-
Configcheck {
60-
/// Path to the configuration file.
61-
#[arg(short, long)]
62-
config: Option<PathBuf>,
63-
/// Path to the users.toml file.
64-
#[arg(short, long)]
65-
users: Option<PathBuf>,
66-
},
59+
Configcheck,
6760

6861
/// Copy data from source to destination cluster
6962
/// using logical replication.

pgdog/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use pgdog::stats;
1111
use pgdog::util::pgdog_version;
1212
use pgdog::{healthcheck, net};
1313
use tokio::runtime::Builder;
14-
use tracing::info;
14+
use tracing::{error, info};
1515

1616
use std::process::exit;
1717

@@ -35,13 +35,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3535
exit(0);
3636
}
3737

38-
Some(Commands::Configcheck { config, users }) => {
39-
if let Err(e) = pgdog::cli::config_check(config, users) {
40-
eprintln!("Configuration error: {}", e);
38+
Some(Commands::Configcheck) => {
39+
if let Err(e) = config::load(&args.config, &args.users) {
40+
error!("{}", e);
4141
exit(1);
4242
}
4343

44-
println!("✅ Configuration valid");
44+
info!("✅ config valid");
4545
exit(0);
4646
}
4747

0 commit comments

Comments
 (0)