From 2bfc831c60181d2abaa16a55d45c7b3d8b988eef Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 31 Jan 2024 17:02:41 +0000 Subject: [PATCH] control_plane/attachment_service: make --path optional (#6545) ## Problem The `--path` argument is only used in testing, for compat tests that use a JSON snapshot of state rather than the postgres database. In regular deployments, it should be omitted (currently one has to specify `--path ""`) ## Summary of changes Make `--path` optional. --- control_plane/attachment_service/src/main.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/control_plane/attachment_service/src/main.rs b/control_plane/attachment_service/src/main.rs index 05a3895dfa..7c716a9f53 100644 --- a/control_plane/attachment_service/src/main.rs +++ b/control_plane/attachment_service/src/main.rs @@ -39,7 +39,7 @@ struct Cli { /// Path to the .json file to store state (will be created if it doesn't exist) #[arg(short, long)] - path: Utf8PathBuf, + path: Option, /// URL to connect to postgres, like postgresql://localhost:1234/attachment_service #[arg(long)] @@ -62,7 +62,7 @@ async fn main() -> anyhow::Result<()> { GIT_VERSION, launch_ts.to_string(), BUILD_TAG, - args.path, + args.path.as_ref().unwrap_or(&Utf8PathBuf::from("")), args.listen ); @@ -70,11 +70,7 @@ async fn main() -> anyhow::Result<()> { jwt_token: args.jwt_token, }; - let json_path = if args.path.as_os_str().is_empty() { - None - } else { - Some(args.path) - }; + let json_path = args.path; let persistence = Arc::new(Persistence::new(args.database_url, json_path.clone())); let service = Service::spawn(config, persistence.clone()).await?;