43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Lucent\Channel;
|
|
|
|
use Lucent\Primitive\Collection;
|
|
use Lucent\Schema\Schema;
|
|
|
|
final class Channel
|
|
{
|
|
public string $lucentUrl;
|
|
public string $filesUrl;
|
|
public string $previewTargetUrl;
|
|
|
|
/**
|
|
* @param Collection<Schema> $schemas
|
|
*/
|
|
function __construct(
|
|
public string $name,
|
|
public string $url,
|
|
public string $previewTarget,
|
|
public string $generateCommand,
|
|
public Collection $schemas,
|
|
public array $imageFilters,
|
|
public array $roles,
|
|
)
|
|
{
|
|
$this->lucentUrl = $url . "/lucent";
|
|
$this->filesUrl = $this->makeFilesUrl();
|
|
$this->previewTargetUrl = $url . "/" . $previewTarget;
|
|
}
|
|
|
|
|
|
private function makeFilesUrl(): string
|
|
{
|
|
return match (config("filesystems.disks.lucent.driver")) {
|
|
"s3" => config("filesystems.disks.lucent.endpoint") . "/" . config("filesystems.disks.lucent.bucket"),
|
|
"local" => $this->url . "/storage" . config("filesystems.disks.lucent.endpoint"),
|
|
};
|
|
|
|
}
|
|
|
|
}
|