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:
parent
aa986507fd
commit
280394f5e0
4 changed files with 8 additions and 5 deletions
|
|
@ -191,8 +191,12 @@ function baseUrl(): string {
|
||||||
return isDev() ? 'https://dev.payfrit.com' : 'https://biz.payfrit.com';
|
return isDev() ? 'https://dev.payfrit.com' : 'https://biz.payfrit.com';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function appRoot(): string {
|
||||||
|
return '/var/www/payfrit-api';
|
||||||
|
}
|
||||||
|
|
||||||
function uploadsRoot(): string {
|
function uploadsRoot(): string {
|
||||||
return '/opt/payfrit-api/uploads';
|
return appRoot() . '/uploads';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
|
||||||
|
|
@ -628,11 +628,10 @@ JSEOF;
|
||||||
|
|
||||||
// Helper: expand a URL path to a local file path
|
// Helper: expand a URL path to a local file path
|
||||||
$expandPath = function(string $urlPath): string {
|
$expandPath = function(string $urlPath): string {
|
||||||
// /uploads/items/123.jpg → /opt/payfrit-api/uploads/items/123.jpg
|
|
||||||
if (str_starts_with($urlPath, '/uploads/')) {
|
if (str_starts_with($urlPath, '/uploads/')) {
|
||||||
return uploadsRoot() . substr($urlPath, 8);
|
return uploadsRoot() . substr($urlPath, 8);
|
||||||
}
|
}
|
||||||
return '/opt/payfrit-api' . $urlPath;
|
return appRoot() . $urlPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper: convert 24h time to 12h format string
|
// Helper: convert 24h time to 12h format string
|
||||||
|
|
|
||||||
|
|
@ -688,7 +688,7 @@ try {
|
||||||
// Clean up temp folder from ZIP upload
|
// Clean up temp folder from ZIP upload
|
||||||
$tempFolder = is_string($data['tempFolder'] ?? null) ? trim($data['tempFolder']) : '';
|
$tempFolder = is_string($data['tempFolder'] ?? null) ? trim($data['tempFolder']) : '';
|
||||||
if (strlen($tempFolder) && preg_match('/^[a-f0-9]{32}$/', $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)) {
|
if (is_dir($tempFolderPath)) {
|
||||||
exec("rm -rf " . escapeshellarg($tempFolderPath));
|
exec("rm -rf " . escapeshellarg($tempFolderPath));
|
||||||
$response['steps'][] = "Cleaned up temp folder: $tempFolder";
|
$response['steps'][] = "Cleaned up temp folder: $tempFolder";
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ runAuth();
|
||||||
$response = ['OK' => false, 'MESSAGE' => '', 'URL' => ''];
|
$response = ['OK' => false, 'MESSAGE' => '', 'URL' => ''];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$tempBaseDir = "/opt/payfrit-api/temp/menu-import";
|
$tempBaseDir = appRoot() . "/temp/menu-import";
|
||||||
|
|
||||||
// Create temp directory if needed
|
// Create temp directory if needed
|
||||||
if (!is_dir($tempBaseDir)) {
|
if (!is_dir($tempBaseDir)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue