- Enhanced deploy-backend.sh and update-backend.sh to create the adult verification directory under /opt/yourpart-data. - Updated permissions for the new directory to ensure proper access control. - Refactored file path handling in AdminService and SettingsService to utilize the new directory structure for adult verification files.
27 lines
990 B
JavaScript
27 lines
990 B
JavaScript
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
function getBackendRoot() {
|
|
return path.join(__dirname, '..');
|
|
}
|
|
|
|
export function getAdultVerificationBaseDir() {
|
|
if (process.env.ADULT_VERIFICATION_DIR && process.env.ADULT_VERIFICATION_DIR.trim()) {
|
|
return process.env.ADULT_VERIFICATION_DIR.trim();
|
|
}
|
|
if (process.env.YOURPART_PERSISTENT_DATA_DIR && process.env.YOURPART_PERSISTENT_DATA_DIR.trim()) {
|
|
return path.join(process.env.YOURPART_PERSISTENT_DATA_DIR.trim(), 'adult-verification');
|
|
}
|
|
if (process.env.STAGE === 'production' || process.env.NODE_ENV === 'production') {
|
|
return '/opt/yourpart-data/adult-verification';
|
|
}
|
|
return path.join(getBackendRoot(), 'images', 'adult-verification');
|
|
}
|
|
|
|
export function getLegacyAdultVerificationBaseDir() {
|
|
return path.join(getBackendRoot(), 'images', 'adult-verification');
|
|
}
|