diff options
author | Alex Auvolat <alex@adnab.me> | 2023-06-14 13:56:37 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-06-14 13:56:37 +0200 |
commit | 28cc9f178a1368e53143aab663577b0ffbf50b35 (patch) | |
tree | 7a18dba4e16ad79b0aa0646364efc4fcbb233908 | |
parent | 2c83006608aba91c9520d75cec3bcc3787c274b2 (diff) | |
download | garage-28cc9f178a1368e53143aab663577b0ffbf50b35.tar.gz garage-28cc9f178a1368e53143aab663577b0ffbf50b35.zip |
admin api: make name optionnal for CreateKey
-rw-r--r-- | src/api/admin/key.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/admin/key.rs b/src/api/admin/key.rs index 25ba76f8..664fde4c 100644 --- a/src/api/admin/key.rs +++ b/src/api/admin/key.rs @@ -65,7 +65,7 @@ pub async fn handle_create_key( ) -> Result<Response<Body>, Error> { let req = parse_json_body::<CreateKeyRequest>(req).await?; - let key = Key::new(&req.name); + let key = Key::new(req.name.as_deref().unwrap_or("Unnamed key")); garage.key_table.insert(&key).await?; key_info_results(garage, key).await @@ -74,7 +74,7 @@ pub async fn handle_create_key( #[derive(Deserialize)] #[serde(rename_all = "camelCase")] struct CreateKeyRequest { - name: String, + name: Option<String>, } pub async fn handle_import_key( |