fix: [roadmap] 개발서버 문서 경로 설정 가능하도록 개선
- config/roadmap.php 추가 (ROADMAP_DOCS_BASE 환경변수)
- RoadmapController에서 config 기반 경로 사용
- 로컬: base_path('../docs') 기본값 유지
- 서버: .env에서 ROADMAP_DOCS_BASE 설정
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
class RoadmapController extends Controller
|
||||
{
|
||||
/** @deprecated config('roadmap.docs_base')로 대체 */
|
||||
private const DOCS_BASE = __DIR__.'/../../../../docs';
|
||||
|
||||
private const DOCUMENT_REGISTRY = [
|
||||
@@ -122,6 +123,13 @@ public function __construct(
|
||||
private readonly RoadmapPlanService $planService
|
||||
) {}
|
||||
|
||||
private function getDocsBasePath(): string
|
||||
{
|
||||
$path = config('roadmap.docs_base', self::DOCS_BASE);
|
||||
|
||||
return realpath($path) ?: $path;
|
||||
}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$summary = $this->planService->getDashboardSummary();
|
||||
@@ -192,7 +200,7 @@ public function documents(): View
|
||||
$registry = self::DOCUMENT_REGISTRY;
|
||||
|
||||
// 각 문서의 파일 존재 여부 확인
|
||||
$docsBase = realpath(self::DOCS_BASE) ?: self::DOCS_BASE;
|
||||
$docsBase = $this->getDocsBasePath();
|
||||
foreach ($registry as &$group) {
|
||||
foreach ($group['items'] as &$item) {
|
||||
$item['exists'] = file_exists($docsBase.'/'.$item['path']);
|
||||
@@ -220,7 +228,7 @@ public function showDocument(string $slug): View
|
||||
abort(404, '문서를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$docsBase = realpath(self::DOCS_BASE) ?: self::DOCS_BASE;
|
||||
$docsBase = $this->getDocsBasePath();
|
||||
$filePath = $docsBase.'/'.$document['path'];
|
||||
$content = null;
|
||||
|
||||
|
||||
15
config/roadmap.php
Normal file
15
config/roadmap.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 로드맵 문서 기본 경로
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 로드맵 문서(마크다운) 파일이 위치한 디렉토리 경로.
|
||||
| 로컬: base_path('../docs') → /home/aweso/sam/docs
|
||||
| 서버: .env에서 ROADMAP_DOCS_BASE 설정 필요
|
||||
|
|
||||
*/
|
||||
'docs_base' => env('ROADMAP_DOCS_BASE', base_path('../docs')),
|
||||
];
|
||||
Reference in New Issue
Block a user