Skip to content

Loading…

Add support for adding headers in .s3cfg file #41

Merged
merged 1 commit into from

6 participants

@relistan

Adding headers with --add-header from the command line is helpful But, it's sometimes nice to be able to set headers for all files in the .s3cfg. For example, to use AES256 encryption on all files uploaded. There are other places this is useful as well. It's a simple change that I think adds decent functionality to s3cmd. Here's how it looks in a config file:

[default]
add_headers = x-amz-server-side-encryption:AES256, x-foo:something

@gavinheavyside

+1 This would be a massive help

@relistan

Still would like to see this merged if you're willing.

@didip

+1

@mdomsch
s3tools member

I've pulled this (relistan/master) branch into a merge branch in my tree. Hopefully that'll help with an official upstream merge down the line...

@relistan

Great, thanks.

@relistan

I see that other pull requests have been merged since I opened this. Is there an objection to this request, or the implementation that is preventing this from getting pulled into master?

@relistan

Anyone home? 8 months and counting!

@hspencer77

There was an announcement a few weeks ago saying that the author was no longer
able to develop this tool. He was asking for volunteers to step in and take
over from him. I've not seen anything indicating that somebody has taken over
so I assume there is still a vacancy.

Hope this helps.

@relistan

Ah, that explains why the pull request list has grown and grown recently. Thanks for the info, I missed that. I'll contact the author directly--hopefully he'll respond. Cheers.

@hspencer77

If you end up wanting to lead the project, I don't mind helping. I don't have the cycles to take the lead on it, but I can help out a great deal. Let me know what you think.

Cheers.

@mludvig mludvig merged commit 50a4233 into s3tools:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 S3/Config.py
View
7 S3/Config.py
@@ -83,6 +83,7 @@ class Config(object):
website_index = "index.html"
website_error = ""
website_endpoint = "http://%(bucket)s.s3-website-%(location)s.amazonaws.com/"
+ add_headers = ""
## Creating a singleton
def __new__(self, configfile = None):
@@ -112,6 +113,12 @@ def read_config_file(self, configfile):
cp = ConfigParser(configfile)
for option in self.option_list():
self.update_option(option, cp.get(option))
+
+ if cp.get('add_headers'):
+ for option in cp.get('add_headers').split(","):
+ (key, value) = option.split(':')
+ self.extra_headers[key.replace('_', '-').strip()] = value.strip()
+
self._parsed_files.append(configfile)
def dump_config(self, stream):
Something went wrong with that request. Please try again.