Browse code

Add support for putting arbitrary additional headers in s3cfg file.

Karl Matthias authored on 2012/04/01 23:51:23
Showing 1 changed files
... ...
@@ -83,6 +83,7 @@ class Config(object):
83 83
     website_index = "index.html"
84 84
     website_error = ""
85 85
     website_endpoint = "http://%(bucket)s.s3-website-%(location)s.amazonaws.com/"
86
+    add_headers = ""
86 87
 
87 88
     ## Creating a singleton
88 89
     def __new__(self, configfile = None):
... ...
@@ -112,6 +113,12 @@ class Config(object):
112 112
         cp = ConfigParser(configfile)
113 113
         for option in self.option_list():
114 114
             self.update_option(option, cp.get(option))
115
+
116
+        if cp.get('add_headers'):
117
+            for option in cp.get('add_headers').split(","):
118
+                (key, value) = option.split(':')
119
+                self.extra_headers[key.replace('_', '-').strip()] = value.strip()
120
+
115 121
         self._parsed_files.append(configfile)
116 122
 
117 123
     def dump_config(self, stream):