chore: sync release updates
This commit is contained in:
@@ -18,11 +18,13 @@ class FileStorageConfigService
|
||||
'driver' => $this->normalizeDriver((string)($rows['driver'] ?? 'local')),
|
||||
'public_base_url' => trim((string)($rows['public_base_url'] ?? '')),
|
||||
'oss_endpoint' => trim((string)($rows['oss_endpoint'] ?? '')),
|
||||
'oss_upload_endpoint' => trim((string)($rows['oss_upload_endpoint'] ?? '')),
|
||||
'oss_bucket' => trim((string)($rows['oss_bucket'] ?? '')),
|
||||
'oss_access_key_id' => trim((string)($rows['oss_access_key_id'] ?? '')),
|
||||
'oss_access_key_secret' => trim((string)($rows['oss_access_key_secret'] ?? '')),
|
||||
'oss_bucket_domain' => trim((string)($rows['oss_bucket_domain'] ?? '')),
|
||||
'oss_path_prefix' => trim((string)($rows['oss_path_prefix'] ?? '')),
|
||||
'direct_upload_max_size_mb' => trim((string)($rows['direct_upload_max_size_mb'] ?? '200')),
|
||||
'qiniu_bucket' => trim((string)($rows['qiniu_bucket'] ?? '')),
|
||||
'qiniu_access_key' => trim((string)($rows['qiniu_access_key'] ?? '')),
|
||||
'qiniu_secret_key' => trim((string)($rows['qiniu_secret_key'] ?? '')),
|
||||
@@ -136,6 +138,27 @@ class FileStorageConfigService
|
||||
return $this->normalizeEndpointHost($this->getConfig()['oss_endpoint']);
|
||||
}
|
||||
|
||||
public function uploadEndpoint(): string
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
$endpoint = $config['oss_upload_endpoint'] !== '' ? $config['oss_upload_endpoint'] : $config['oss_endpoint'];
|
||||
|
||||
return $this->normalizeEndpointHost($endpoint);
|
||||
}
|
||||
|
||||
public function directUploadMaxBytes(): int
|
||||
{
|
||||
$value = (int)$this->getConfig()['direct_upload_max_size_mb'];
|
||||
$megabytes = max(1, min(2048, $value > 0 ? $value : 200));
|
||||
|
||||
return $megabytes * 1024 * 1024;
|
||||
}
|
||||
|
||||
public function directUploadMaxLabel(): string
|
||||
{
|
||||
return sprintf('%dMB', (int)($this->directUploadMaxBytes() / 1024 / 1024));
|
||||
}
|
||||
|
||||
public function accessKeyId(): string
|
||||
{
|
||||
return $this->getConfig()['oss_access_key_id'];
|
||||
|
||||
Reference in New Issue
Block a user