Provides a gitignored override file for credentials like LinkedIn OAuth keys, avoiding reliance on Apache SetEnv / PHP-FPM env config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?php
|
|
if (!defined('ROOT')) define('ROOT', dirname(__DIR__));
|
|
|
|
$config = require ROOT . '/config/config.php';
|
|
|
|
if (file_exists(ROOT . '/config.local.php')) {
|
|
require_once ROOT . '/config.local.php';
|
|
}
|
|
|
|
ini_set('session.cookie_httponly', '1');
|
|
ini_set('session.use_strict_mode', '1');
|
|
session_name($config['session_name']);
|
|
session_start();
|
|
|
|
require_once ROOT . '/lib/DB.php';
|
|
require_once ROOT . '/lib/Auth.php';
|
|
require_once ROOT . '/lib/ProjectTypes.php';
|
|
require_once ROOT . '/lib/Audit.php';
|
|
|
|
$db = DB::connect($config['db_path']);
|
|
DB::autoMigrate(ROOT . '/sql');
|
|
|
|
/**
|
|
* Returns the deploy fingerprint as ['version','sha','branch','built'] read
|
|
* from web/BUILD — the file is generated by deploy.sh / deploylocal.sh and
|
|
* never committed (see .gitignore). Falls back to 'dev' if missing.
|
|
*
|
|
* Mirrors /opt/agenda/web/lib/layout.php:buildInfo().
|
|
*/
|
|
function buildInfo(): array {
|
|
static $info = null;
|
|
if ($info !== null) return $info;
|
|
$info = ['version' => 'dev', 'sha' => '', 'branch' => '', 'built' => ''];
|
|
$file = ROOT . '/web/BUILD';
|
|
if (!is_readable($file)) return $info;
|
|
foreach (file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
|
|
if (strpos($line, '=') === false) continue;
|
|
[$k, $v] = array_map('trim', explode('=', $line, 2));
|
|
if (isset($info[$k])) $info[$k] = $v;
|
|
}
|
|
return $info;
|
|
}
|