Move app from /opt to /var/www/payfrit-api (standard Linux web dir)

- Moved directory on both dev and biz servers
- Updated nginx configs on both servers
- Added appRoot() helper, uploadsRoot() uses it
- No more hardcoded /opt/payfrit-api paths in codebase

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-14 22:32:55 -07:00
parent aa986507fd
commit 280394f5e0
4 changed files with 8 additions and 5 deletions

View file

@ -191,8 +191,12 @@ function baseUrl(): string {
return isDev() ? 'https://dev.payfrit.com' : 'https://biz.payfrit.com';
}
function appRoot(): string {
return '/var/www/payfrit-api';
}
function uploadsRoot(): string {
return '/opt/payfrit-api/uploads';
return appRoot() . '/uploads';
}
// ============================================

View file

@ -628,11 +628,10 @@ JSEOF;
// Helper: expand a URL path to a local file path
$expandPath = function(string $urlPath): string {
// /uploads/items/123.jpg → /opt/payfrit-api/uploads/items/123.jpg
if (str_starts_with($urlPath, '/uploads/')) {
return uploadsRoot() . substr($urlPath, 8);
}
return '/opt/payfrit-api' . $urlPath;
return appRoot() . $urlPath;
};
// Helper: convert 24h time to 12h format string

View file

@ -688,7 +688,7 @@ try {
// Clean up temp folder from ZIP upload
$tempFolder = is_string($data['tempFolder'] ?? null) ? trim($data['tempFolder']) : '';
if (strlen($tempFolder) && preg_match('/^[a-f0-9]{32}$/', $tempFolder)) {
$tempFolderPath = "/opt/payfrit-api/temp/menu-import/$tempFolder";
$tempFolderPath = appRoot() . "/temp/menu-import/$tempFolder";
if (is_dir($tempFolderPath)) {
exec("rm -rf " . escapeshellarg($tempFolderPath));
$response['steps'][] = "Cleaned up temp folder: $tempFolder";

View file

@ -12,7 +12,7 @@ runAuth();
$response = ['OK' => false, 'MESSAGE' => '', 'URL' => ''];
try {
$tempBaseDir = "/opt/payfrit-api/temp/menu-import";
$tempBaseDir = appRoot() . "/temp/menu-import";
// Create temp directory if needed
if (!is_dir($tempBaseDir)) {