Browse code

Add --host and --host-bucket command line options

To update Config().host_base and host_bucket via CLI without
having to edit the config file. Useful when specifying
a non-S3 host.

Likely also want to set --region.

Matt Domsch authored on 2015/12/10 23:54:02
Showing 1 changed files
... ...
@@ -2472,7 +2472,7 @@ class MyHelpFormatter(IndentedHelpFormatter):
2472 2472
 
2473 2473
 def main():
2474 2474
     global cfg
2475
-
2475
+    cfg = Config()
2476 2476
     commands_list = get_commands_list()
2477 2477
     commands = {}
2478 2478
 
... ...
@@ -2544,6 +2544,8 @@ def main():
2544 2544
 
2545 2545
     optparser.add_option(      "--files-from", dest="files_from", action="append", metavar="FILE", help="Read list of source-file names from FILE. Use - to read from stdin.")
2546 2546
     optparser.add_option(      "--region", "--bucket-location", metavar="REGION", dest="bucket_location", help="Region to create bucket in. As of now the regions are: us-east-1, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-northeast-1, ap-southeast-1, ap-southeast-2, sa-east-1")
2547
+    optparser.add_option(      "--host", metavar="HOSTNAME", dest="host_base", help="HOSTNAME:PORT for S3 endpoint (default: %s, alternatives such as s3-eu-west-1.amazonaws.com). You should also set --host-bucket." % (cfg.host_base))
2548
+    optparser.add_option(      "--host-bucket", dest="host_bucket", help="DNS-style bucket+hostname:port template for accessing a bucket (default: %s)" % (cfg.host_bucket))
2547 2549
     optparser.add_option(      "--reduced-redundancy", "--rr", dest="reduced_redundancy", action="store_true", help="Store object with 'Reduced redundancy'. Lower per-GB price. [put, cp, mv]")
2548 2550
     optparser.add_option(      "--no-reduced-redundancy", "--no-rr", dest="reduced_redundancy", action="store_false", help="Store object without 'Reduced redundancy'. Higher per-GB price. [put, cp, mv]")
2549 2551
     optparser.add_option(      "--storage-class", dest="storage_class", action="store", metavar="CLASS", help="Store object with specified CLASS (STANDARD, STANDARD_IA, or REDUCED_REDUNDANCY). Lower per-GB price. [put, cp, mv]")