Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for #303 #304

Merged
merged 1 commit into from Mar 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions S3/Config.py
Expand Up @@ -115,18 +115,24 @@ class Config(object):
expiry_prefix = ""

## Creating a singleton
def __new__(self, configfile = None):
def __new__(self, configfile = None, access_key=None, secret_key=None):
if self._instance is None:
self._instance = object.__new__(self)
return self._instance

def __init__(self, configfile = None):
def __init__(self, configfile = None, access_key=None, secret_key=None):
if configfile:
try:
self.read_config_file(configfile)
except IOError, e:
if 'AWS_CREDENTIAL_FILE' in os.environ:
self.env_config()

# override these if passed on the command-line
if access_key and secret_key:
self.access_key = access_key
self.secret_key = secret_key

if len(self.access_key)==0:
self.role_config()

Expand Down
2 changes: 1 addition & 1 deletion s3cmd
Expand Up @@ -2163,7 +2163,7 @@ def main():
sys.exit(1)

try:
cfg = Config(options.config)
cfg = Config(options.config, options.access_key, options.secret_key)
except IOError, e:
if options.run_configure:
cfg = Config()
Expand Down