refactor: extract configuration into config.php

- New config.php.example template (tracked)
- config.php git-ignored
- index.php loads config.php if present, falls back to defaults
This commit is contained in:
Johann
2026-06-09 17:19:46 +02:00
parent 013a9bc20e
commit a8f78536f0
3 changed files with 19 additions and 2 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
# PHP file browser
# (index.php and AGENTS.md are the project files)
config.php
+11
View File
@@ -0,0 +1,11 @@
<?php
/**
* phpfilebrowser — Configuration
*
* Copy this file to config.php and adjust the values.
* config.php is git-ignored; config.php.example is tracked.
*/
// ── Directory to browse ─────────────────────────────────────────
// Absolute path to the root directory the browser should serve
define('ENTRY_POINT', '/var/www');
+7 -1
View File
@@ -5,7 +5,13 @@
*/
// ── Configuration ──────────────────────────────────────────────────────────
define('ENTRY_POINT', '/tmp'); // Change to desired root directory
// Load config.php if present, otherwise use defaults
if (file_exists(__DIR__ . '/config.php')) {
require __DIR__ . '/config.php';
}
if (!defined('ENTRY_POINT')) {
define('ENTRY_POINT', '/tmp');
}
// ── Helpers ────────────────────────────────────────────────────────────────