mirror of
https://github.com/easingthemes/ssh-deploy.git
synced 2024-11-19 08:08:05 +08:00
Compare commits
2 Commits
v4.1.10
...
3cd2cdf0ef
Author | SHA1 | Date | |
---|---|---|---|
|
3cd2cdf0ef | ||
|
3405be3b42 |
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
|||||||
const { join } = require('path');
|
const { join } = require('path');
|
||||||
const { execSync } = require('child_process');
|
const { execSync } = require('child_process');
|
||||||
|
const { EOL } = require('os');
|
||||||
const { writeToFile } = require('./helpers');
|
const { writeToFile } = require('./helpers');
|
||||||
|
|
||||||
const KNOWN_HOSTS = 'known_hosts';
|
const KNOWN_HOSTS = 'known_hosts';
|
||||||
@@ -18,9 +19,9 @@ const getPrivateKeyPath = (filename = '') => {
|
|||||||
const addSshKey = (content, deployKeyName) => {
|
const addSshKey = (content, deployKeyName) => {
|
||||||
const { dir, filename } = getPrivateKeyPath(deployKeyName);
|
const { dir, filename } = getPrivateKeyPath(deployKeyName);
|
||||||
writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
|
writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
|
||||||
console.log('✅ [SSH] known_hosts file ensured', dir);
|
console.log('??? [SSH] known_hosts file ensured', dir);
|
||||||
writeToFile({ dir, filename, content: `${content}\r\n`, isRequired: true, mode: '0400' });
|
writeToFile({ dir, filename, content: `${content}${EOL}`, isRequired: true, mode: '0400' });
|
||||||
console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename);
|
console.log('??? [SSH] key added to `.ssh` dir ', dir, filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateKnownHosts = (host, remotePort) => {
|
const updateKnownHosts = (host, remotePort) => {
|
||||||
@@ -31,9 +32,9 @@ const updateKnownHosts = (host, remotePort) => {
|
|||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ [SSH] Adding host to `known_hosts` ERROR', host, error.message);
|
console.error('??? [SSH] Adding host to `known_hosts` ERROR', host, error.message);
|
||||||
}
|
}
|
||||||
console.log('✅ [SSH] Adding host to `known_hosts` DONE', host, knownHostsPath);
|
console.log('??? [SSH] Adding host to `known_hosts` DONE', host, knownHostsPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Reference in New Issue
Block a user