-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aloks98
committed
Oct 28, 2022
1 parent
2a1a4d2
commit 4069fdc
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Utopia\Storage\Device; | ||
|
||
use Utopia\Storage\Device\S3; | ||
|
||
class DreamObjects extends S3 | ||
{ | ||
/** | ||
* Regions constants | ||
* | ||
*/ | ||
const US_EAST_1='us-east-1'; | ||
|
||
/** | ||
* Object Storage Constructor | ||
* | ||
* @param string $root | ||
* @param string $accessKey | ||
* @param string $secretKey | ||
* @param string $bucket | ||
* @param string $region | ||
* @param string $acl | ||
*/ | ||
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::US_EAST_1, string $acl = self::ACL_PRIVATE) | ||
{ | ||
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl); | ||
$this->headers['host'] = $bucket.'objects-'.$region.'.'.'dream.io'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return 'DreamHost Object Storage'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription(): string | ||
{ | ||
return 'DreamHost Object Storage'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Utopia\Tests; | ||
|
||
use Utopia\Storage\Device\DreamObjects; | ||
use Utopia\Tests\S3Base; | ||
|
||
class DreamObjectsTest extends S3Base | ||
{ | ||
protected function init(): void | ||
{ | ||
$this->root = '/root'; | ||
$key = $_SERVER['DREAMOBJECTS_ACCESS_KEY'] ?? ''; | ||
$secret = $_SERVER['DREAMOBJECTS_SECRET'] ?? ''; | ||
$bucket = "utopia-dreamobjects-store"; | ||
|
||
$this->object = new DreamObjects($this->root, $key, $secret, $bucket, DreamObjects::US_EAST_1, DreamObjects::ACL_PUBLIC_READ); | ||
|
||
} | ||
|
||
protected function getAdapterName(): string | ||
{ | ||
return 'DreamHost Object Storage'; | ||
} | ||
|
||
protected function getAdapterDescription(): string | ||
{ | ||
return 'DreamHost Object Storage'; | ||
} | ||
} |