diff --git a/config/config.php.example b/config/config.default.php similarity index 90% rename from config/config.php.example rename to config/config.default.php index 2b45788..628ae23 100644 --- a/config/config.php.example +++ b/config/config.default.php @@ -1,6 +1,6 @@ "127.0.0.1", "db_port" => 5432, "db_name" => "realfan", diff --git a/src/base.php b/src/base.php index 1f8de65..ca65425 100644 --- a/src/base.php +++ b/src/base.php @@ -28,15 +28,19 @@ function lr($key, $default='') { # read config $config = []; +require_once '/config/config.default.php'; if (file_exists('/config/config.php')) { require_once '/config/config.php'; } function conf($key, $default='') { global $config; + global $default_config; if (isset($config[$key])) return $config[$key]; - return $default; + if (!empty($default)) + return $default; + return $default_config[$key]; } require_once '/src/base.methods.php';