UNPKG

yemot-backup

Version:

Automatic backup tool for Yemot HaMashiach call recordings to Amazon S3

50 lines (41 loc) 1.36 kB
require('dotenv').config(); const config = { // General settings logLevel: process.env.LOG_LEVEL || 'info', // AWS S3 Configuration aws: { accessKeyId: process.env.AWS_ACCESS_KEY_ID || '', secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || '', region: process.env.AWS_REGION || 'us-east-1', bucket: process.env.AWS_S3_BUCKET || '', }, // Backup schedule (cron format) schedule: process.env.BACKUP_SCHEDULE || '0 0 * * *', // Default: everyday at midnight // Yemot systems configuration - loaded from systems.json systems: [], // Load systems from JSON file loadSystems() { try { const systems = require('./systems.json'); this.systems = systems; return true; } catch (error) { console.error('Failed to load systems configuration:', error.message); this.systems = []; return false; } }, // Check if AWS is configured isAwsConfigured() { return !!(this.aws.accessKeyId && this.aws.secretAccessKey && this.aws.bucket); }, // Check if any systems are configured hasConfiguredSystems() { return this.systems.length > 0; }, // Check if all configuration is valid isFullyConfigured() { return this.isAwsConfigured() && this.hasConfiguredSystems(); } }; module.exports = config;