import { S3Service } from './src/services/s3Service.js'; async function testS3ServiceConfig() { try { console.log('๐Ÿงช Testing S3Service configuration loading...'); // Test loading configuration from file const config = await S3Service.loadConfig(); console.log('โœ… Configuration loaded from s3-config.json:'); console.log(` Endpoint: ${config.endpoint}`); console.log(` Region: ${config.region}`); console.log(` Bucket: ${config.bucketName}`); console.log(` UseSSL: ${config.useSSL}`); console.log(` AccessKeyId: ${config.accessKeyId ? '***' : 'not set'}`); console.log(` SecretAccessKey: ${config.secretAccessKey ? '***' : 'not set'}`); // Test creating S3Service instance const s3Service = await S3Service.createFromConfig(); console.log('โœ… S3Service instance created successfully'); // Test listing files (this will verify the connection works) console.log('๐Ÿ“ Testing file listing...'); const files = await s3Service.listAllFiles(); console.log(`โœ… Found ${files.length} files in bucket`); if (files.length > 0) { console.log(' Sample files:'); files.slice(0, 3).forEach(file => { console.log(` - ${file.key} (${file.size} bytes)`); }); } console.log('\n๐ŸŽ‰ S3Service configuration test passed!'); console.log(' The S3 sync is now using the correct configuration from s3-config.json'); } catch (error) { console.error('โŒ S3Service configuration test failed:', error.message); console.log('\n๐Ÿ’ก This means the S3 sync will fall back to environment variables'); } } testS3ServiceConfig();