Skip to content
Open
Show file tree
Hide file tree
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
43 changes: 43 additions & 0 deletions src/Storage/Device/DreamObjects.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Utopia\Storage\Device;

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';
}
}
2 changes: 2 additions & 0 deletions src/Storage/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Storage

const DEVICE_LINODE = 'linode';

const DEVICE_DREAMOBJECTS = 'dreamobjects';

/**
* Devices.
*
Expand Down
30 changes: 30 additions & 0 deletions tests/Storage/Device/DreamObjectsTest.php
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\Storage\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';
}
}