Files
yourpart3/backend/utils/storagePaths.js

27 lines
990 B
JavaScript
Executable File

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');
}