mirror of
https://github.com/easingthemes/ssh-deploy.git
synced 2024-04-28 00:37:18 +08:00
21 lines
485 B
JavaScript
21 lines
485 B
JavaScript
const { join } = require('path');
|
|
|
|
const { writeToFile } = require('./helpers');
|
|
|
|
const addSshKey = (content, filename) => {
|
|
const { HOME } = process.env;
|
|
const dir = join(HOME || __dirname, '.ssh');
|
|
const filePath = join(dir, filename);
|
|
|
|
writeToFile({ dir, filename: 'known_hosts', content: '' });
|
|
writeToFile({ dir, filename, content, isRequired: true });
|
|
|
|
console.log('✅ [SSH] key added to `.ssh` dir ', dir);
|
|
|
|
return filePath;
|
|
};
|
|
|
|
module.exports = {
|
|
addSshKey
|
|
};
|