aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-06-14 13:56:37 +0200
committerAlex Auvolat <alex@adnab.me>2023-06-14 13:56:37 +0200
commit28cc9f178a1368e53143aab663577b0ffbf50b35 (patch)
tree7a18dba4e16ad79b0aa0646364efc4fcbb233908 /src/api/admin
parent2c83006608aba91c9520d75cec3bcc3787c274b2 (diff)
downloadgarage-28cc9f178a1368e53143aab663577b0ffbf50b35.tar.gz
garage-28cc9f178a1368e53143aab663577b0ffbf50b35.zip
admin api: make name optionnal for CreateKey
Diffstat (limited to 'src/api/admin')
-rw-r--r--src/api/admin/key.rs4
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(