From 9eb211948ec54430170e981201fe33b3997e2da5 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 6 Jan 2022 12:58:21 +0100 Subject: [PATCH] Allow setting index document and error document on the CLI --- src/garage/admin.rs | 4 ++-- src/garage/cli/structs.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/garage/admin.rs b/src/garage/admin.rs index 4a53792d..f9ec1593 100644 --- a/src/garage/admin.rs +++ b/src/garage/admin.rs @@ -404,8 +404,8 @@ impl AdminRpcHandler { let website = if query.allow { Some(WebsiteConfig { - index_document: "index.html".into(), - error_document: None, + index_document: query.index_document.clone(), + error_document: query.error_document.clone(), }) } else { None diff --git a/src/garage/cli/structs.rs b/src/garage/cli/structs.rs index a544d6a1..30cbb2da 100644 --- a/src/garage/cli/structs.rs +++ b/src/garage/cli/structs.rs @@ -188,6 +188,14 @@ pub struct WebsiteOpt { /// Bucket name pub bucket: String, + + /// Index document: the suffix appended to request paths ending by / + #[structopt(short = "i", long = "index-document", default_value = "index.html")] + pub index_document: String, + + /// Error document: the optionnal document returned when an error occurs + #[structopt(short = "e", long = "error-document")] + pub error_document: Option, } #[derive(Serialize, Deserialize, StructOpt, Debug)]