Remove website redirects

This commit is contained in:
Alex Auvolat 2022-01-03 15:06:19 +01:00
parent beeef4758e
commit 2140cd7205
No known key found for this signature in database
GPG key ID: EDABF9711E244EB1
4 changed files with 14 additions and 20 deletions

View file

@ -170,16 +170,16 @@ impl WebsiteConfiguration {
} }
pub fn into_garage_website_config(self) -> Result<WebsiteConfig, Error> { pub fn into_garage_website_config(self) -> Result<WebsiteConfig, Error> {
if let Some(rart) = self.redirect_all_requests_to { if self.redirect_all_requests_to.is_some() {
Ok(WebsiteConfig::RedirectAll { Err(Error::NotImplemented(
hostname: rart.hostname.0, "S3 website redirects are not currently implemented in Garage.".into(),
protocol: rart ))
.protocol } else if self.routing_rules.map(|x| !x.is_empty()).unwrap_or(false) {
.map(|x| x.0) Err(Error::NotImplemented(
.unwrap_or_else(|| "http".to_string()), "S3 routing rules are not currently implemented in Garage.".into(),
}) ))
} else { } else {
Ok(WebsiteConfig::Website { Ok(WebsiteConfig {
index_document: self index_document: self
.index_document .index_document
.map(|x| x.suffix.0) .map(|x| x.suffix.0)

View file

@ -541,7 +541,7 @@ impl AdminRpcHandler {
} }
let website = if query.allow { let website = if query.allow {
Some(WebsiteConfig::Website { Some(WebsiteConfig {
index_document: "index.html".into(), index_document: "index.html".into(),
error_document: None, error_document: None,
}) })

View file

@ -43,15 +43,9 @@ pub struct BucketParams {
} }
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)] #[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
pub enum WebsiteConfig { pub struct WebsiteConfig {
RedirectAll { pub index_document: String,
hostname: String, pub error_document: Option<String>,
protocol: String,
},
Website {
index_document: String,
error_document: Option<String>,
},
} }
impl BucketParams { impl BucketParams {

View file

@ -70,7 +70,7 @@ impl Migrate {
let alias_ts = aliases.get_timestamp(&new_name); let alias_ts = aliases.get_timestamp(&new_name);
let website = if *old_bucket_p.website.get() { let website = if *old_bucket_p.website.get() {
Some(WebsiteConfig::Website { Some(WebsiteConfig {
index_document: "index.html".into(), index_document: "index.html".into(),
error_document: None, error_document: None,
}) })