🛠️ Improve code readability by reformatting console logs and removing unnecessary whitespace
This commit is contained in:
@@ -223,7 +223,9 @@ async function deploy() {
|
||||
console.log('\n🔐 Connecting to Synology...');
|
||||
const keyPath = expandTilde(sshConfig.privateKeyPath);
|
||||
console.log(` 🔑 Using SSH key: ${keyPath}`);
|
||||
console.log(` 📍 Target: ${sshConfig.username}@${sshConfig.host}:${sshConfig.port}`);
|
||||
console.log(
|
||||
` 📍 Target: ${sshConfig.username}@${sshConfig.host}:${sshConfig.port}`
|
||||
);
|
||||
|
||||
// Verify key file exists
|
||||
if (!fs.existsSync(keyPath)) {
|
||||
@@ -253,13 +255,21 @@ async function deploy() {
|
||||
console.error('\n❌ SSH Connection Failed');
|
||||
console.error(`Error: ${connError.message}`);
|
||||
console.error('\nPossible causes:');
|
||||
console.error('1. SSH public key not added to ~/.ssh/authorized_keys on the server');
|
||||
console.error(
|
||||
'1. SSH public key not added to ~/.ssh/authorized_keys on the server'
|
||||
);
|
||||
console.error('2. SSH key has wrong permissions (should be 600)');
|
||||
console.error('3. SSH user home directory permissions are wrong');
|
||||
console.error('\nVerify the key works manually:');
|
||||
console.error(` ssh -i ${keyPath} ${sshConfig.username}@${sshConfig.host} -p ${sshConfig.port} "whoami"`);
|
||||
console.error('\nIf that fails, the public key needs to be added on the server:');
|
||||
console.error(` cat ~/.ssh/${path.basename(keyPath)}.pub | ssh ${sshConfig.username}@${sshConfig.host} -p ${sshConfig.port} "cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"`);
|
||||
console.error(
|
||||
` ssh -i ${keyPath} ${sshConfig.username}@${sshConfig.host} -p ${sshConfig.port} "whoami"`
|
||||
);
|
||||
console.error(
|
||||
'\nIf that fails, the public key needs to be added on the server:'
|
||||
);
|
||||
console.error(
|
||||
` cat ~/.ssh/${path.basename(keyPath)}.pub | ssh ${sshConfig.username}@${sshConfig.host} -p ${sshConfig.port} "cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"`
|
||||
);
|
||||
throw new Error(`SSH connection failed: ${connError.message}`);
|
||||
}
|
||||
|
||||
@@ -461,9 +471,7 @@ async function deploy() {
|
||||
`Failed to transfer ${fileName}: ${catResult.stderr}`
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
` ✅ ${fileName} (${fs.statSync(file.local).size} bytes)`
|
||||
);
|
||||
console.log(` ✅ ${fileName} (${fs.statSync(file.local).size} bytes)`);
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to transfer ${fileName}: ${error.message}`);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,9 @@ const sshConfig = {
|
||||
};
|
||||
|
||||
console.log('🔧 Testing SSH Connection\n');
|
||||
console.log(`📍 Target: ${sshConfig.username}@${sshConfig.host}:${sshConfig.port}`);
|
||||
console.log(
|
||||
`📍 Target: ${sshConfig.username}@${sshConfig.host}:${sshConfig.port}`
|
||||
);
|
||||
console.log(`🔑 Key: ${keyPath}`);
|
||||
|
||||
// Check key exists
|
||||
|
||||
Reference in New Issue
Block a user