diff --git a/app/Http/Controllers/RoadmapController.php b/app/Http/Controllers/RoadmapController.php index 4e8abd99..d7e7e813 100644 --- a/app/Http/Controllers/RoadmapController.php +++ b/app/Http/Controllers/RoadmapController.php @@ -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; diff --git a/config/roadmap.php b/config/roadmap.php new file mode 100644 index 00000000..d1227bae --- /dev/null +++ b/config/roadmap.php @@ -0,0 +1,15 @@ + env('ROADMAP_DOCS_BASE', base_path('../docs')), +];