mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
/data and /tmp standarization
This commit is contained in:
@@ -9,15 +9,28 @@ require 'php/templates/header.php';
|
||||
ini_set ('max_execution_time','30');
|
||||
|
||||
// check permissions
|
||||
$dbPath = "../db/app.db";
|
||||
$confPath = "../config/app.conf";
|
||||
// Use environment-aware paths with fallback to legacy locations
|
||||
$dbFolderPath = rtrim(getenv('NETALERTX_DB') ?: '/data/db', '/');
|
||||
$configFolderPath = rtrim(getenv('NETALERTX_CONFIG') ?: '/data/config', '/');
|
||||
|
||||
$dbPath = $dbFolderPath . '/app.db';
|
||||
$confPath = $configFolderPath . '/app.conf';
|
||||
|
||||
// Fallback to legacy paths if new locations don't exist
|
||||
if (!file_exists($dbPath) && file_exists('../db/app.db')) {
|
||||
$dbPath = '../db/app.db';
|
||||
}
|
||||
if (!file_exists($confPath) && file_exists('../config/app.conf')) {
|
||||
$confPath = '../config/app.conf';
|
||||
}
|
||||
|
||||
checkPermissions([$dbPath, $confPath]);
|
||||
|
||||
// get settings from the API json file
|
||||
|
||||
// path to your JSON file
|
||||
$file = '../api/table_settings.json';
|
||||
$apiRoot = rtrim(getenv('NETALERTX_API') ?: '/tmp/api', '/');
|
||||
$file = $apiRoot . '/table_settings.json';
|
||||
// put the content of the file in a variable
|
||||
$data = file_get_contents($file);
|
||||
// JSON decode
|
||||
|
||||
Reference in New Issue
Block a user