Revert "fix: [bending] Docker 환경 API 호출 시 internal_url 미사용 500 에러 수정"
This reverts commit fc1a28e552.
This commit is contained in:
@@ -130,63 +130,6 @@ public function blockEdit(int $id): View
|
||||
/**
|
||||
* 현재 선택된 테넌트 조회
|
||||
*/
|
||||
/**
|
||||
* API에서 presigned URL 발급
|
||||
*/
|
||||
private function getPresignedUrlFromApi(int $fileId): ?string
|
||||
{
|
||||
$baseUrl = config('services.api.base_url', 'https://api.sam.kr');
|
||||
$internalUrl = config('services.api.internal_url');
|
||||
$apiKey = config('services.api.key');
|
||||
$token = session('api_access_token', '');
|
||||
|
||||
$headers = [
|
||||
'X-API-KEY' => $apiKey,
|
||||
'X-TENANT-ID' => session('selected_tenant_id', 1),
|
||||
];
|
||||
|
||||
if ($internalUrl) {
|
||||
$headers['Host'] = parse_url($baseUrl, PHP_URL_HOST) ?: 'api.sam.kr';
|
||||
$baseUrl = $internalUrl;
|
||||
}
|
||||
|
||||
$response = \Illuminate\Support\Facades\Http::baseUrl($baseUrl)
|
||||
->withoutVerifying()
|
||||
->withHeaders($headers)
|
||||
->withToken($token)
|
||||
->timeout(10)
|
||||
->get("/api/v1/files/{$fileId}/presigned-url");
|
||||
|
||||
return $response->successful() ? $response->json('data.url') : null;
|
||||
}
|
||||
|
||||
private function getPresignedUrlByPath(string $path): ?string
|
||||
{
|
||||
$baseUrl = config('services.api.base_url', 'https://api.sam.kr');
|
||||
$internalUrl = config('services.api.internal_url');
|
||||
$apiKey = config('services.api.key');
|
||||
$token = session('api_access_token', '');
|
||||
|
||||
$headers = [
|
||||
'X-API-KEY' => $apiKey,
|
||||
'X-TENANT-ID' => session('selected_tenant_id', 1),
|
||||
];
|
||||
|
||||
if ($internalUrl) {
|
||||
$headers['Host'] = parse_url($baseUrl, PHP_URL_HOST) ?: 'api.sam.kr';
|
||||
$baseUrl = $internalUrl;
|
||||
}
|
||||
|
||||
$response = \Illuminate\Support\Facades\Http::baseUrl($baseUrl)
|
||||
->withoutVerifying()
|
||||
->withHeaders($headers)
|
||||
->withToken($token)
|
||||
->timeout(10)
|
||||
->post('/api/v1/files/presigned-url-by-path', ['path' => $path]);
|
||||
|
||||
return $response->successful() ? $response->json('data.url') : null;
|
||||
}
|
||||
|
||||
private function getCurrentTenant(): ?Tenant
|
||||
{
|
||||
$tenantId = session('selected_tenant_id');
|
||||
|
||||
Reference in New Issue
Block a user