feat(deploy): add adult verification directory creation and permissions setup
- 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.
This commit is contained in:
26
backend/utils/storagePaths.js
Normal file
26
backend/utils/storagePaths.js
Normal file
@@ -0,0 +1,26 @@
|
||||
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');
|
||||
}
|
||||
Reference in New Issue
Block a user