Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,29 @@ public function __construct($accessKey = null, $secretKey = null, $useSSL = fals
self::$endpoint = $endpoint;
}

/**
* Initializes S3 from a config file.
*
* @param array configuration
* @return void
*/
public function initialize($config) {

// Load config file if config not defined.
if (empty($config)) {
get_instance()->config->load('s3', TRUE);
$config = get_instance()->config->item('s3');
}

foreach ($config as $key => $val) {
if(!in_array($key, array('accessKey', 'secretKey'))) {
self::$$key = $val;
}
}

if (isset($config["accessKey"]) && isset($config["secretKey"]))
self::setAuth($config["accessKey"], $config["secretKey"]);
}

/**
* Set the service endpoint
Expand Down