]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add a configurable to enable/disable static website
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 22 Jan 2016 00:35:29 +0000 (16:35 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 22 Jan 2016 00:35:29 +0000 (16:35 -0800)
rgw_enable_static_website

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/common/config_opts.h
src/rgw/rgw_rest_s3.cc

index 6cf836a29a192b66e6b0fec549532202a3a44dad..c8742fbd5acc7ed2577771d9a0cb291d12df7e2c 100644 (file)
@@ -1245,6 +1245,8 @@ OPTION(rgw_objexp_time_step, OPT_U32, 4096) // number of seconds for rounding th
 OPTION(rgw_objexp_hints_num_shards, OPT_U32, 127) // maximum number of parts in which the hint index is stored in
 OPTION(rgw_objexp_chunk_size, OPT_U32, 100) // maximum number of entries in a single operation when processing objexp data
 
+OPTION(rgw_enable_static_website, OPT_BOOL, false) // enable static website feature
+
 OPTION(mutex_perf_counter, OPT_BOOL, false) // enable/disable mutex perf counter
 OPTION(throttler_perf_counter, OPT_BOOL, true) // enable/disable throttler perf counter
 
index f2b56e2057aeccde883cfefae31c38a93d754ddb..91eb4652537d42b5e193062f2c03afbac077cf28 100644 (file)
@@ -2224,8 +2224,12 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_get()
   if (s->info.args.sub_resource_exists("versioning"))
     return new RGWGetBucketVersioning_ObjStore_S3;
 
-  if (s->info.args.sub_resource_exists("website"))
+  if (s->info.args.sub_resource_exists("website")) {
+    if (!s->cct->_conf->rgw_enable_static_website) {
+      return NULL;
+    }
     return new RGWGetBucketWebsite_ObjStore_S3;
+  }
 
   if (is_acl_op()) {
     return new RGWGetACLs_ObjStore_S3;
@@ -2255,8 +2259,12 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_put()
     return NULL;
   if (s->info.args.sub_resource_exists("versioning"))
     return new RGWSetBucketVersioning_ObjStore_S3;
-  if (s->info.args.sub_resource_exists("website"))
+  if (s->info.args.sub_resource_exists("website")) {
+    if (!s->cct->_conf->rgw_enable_static_website) {
+      return NULL;
+    }
     return new RGWSetBucketWebsite_ObjStore_S3;
+  }
   if (is_acl_op()) {
     return new RGWPutACLs_ObjStore_S3;
   } else if (is_cors_op()) {
@@ -2273,8 +2281,12 @@ RGWOp *RGWHandler_ObjStore_Bucket_S3::op_delete()
     return new RGWDeleteCORS_ObjStore_S3;
   }
 
-  if (s->info.args.sub_resource_exists("website"))
+  if (s->info.args.sub_resource_exists("website")) {
+    if (!s->cct->_conf->rgw_enable_static_website) {
+      return NULL;
+    }
     return new RGWDeleteBucketWebsite_ObjStore_S3;
+  }
 
   return new RGWDeleteBucket_ObjStore_S3;
 }