mirror of
				https://github.com/easingthemes/ssh-deploy.git
				synced 2025-10-30 23:30:09 +08:00 
			
		
		
		
	add logs
This commit is contained in:
		
							parent
							
								
									935fc586de
								
							
						
					
					
						commit
						85dc1a16ee
					
				| @ -3,17 +3,17 @@ const { join } = require('path'); | ||||
| 
 | ||||
| const validateDir = (dir) => { | ||||
|   if (!dir) { | ||||
|     console.log('[SSH] dir is not defined'); | ||||
|     console.log('[DIR] dir is not defined'); | ||||
|     return; | ||||
|   } | ||||
|   if (existsSync(dir)) { | ||||
|     console.log(`[SSH] ${dir} dir exist`); | ||||
|     console.log(`[DIR] ${dir} dir exist`); | ||||
|     return; | ||||
|   } | ||||
| 
 | ||||
|   console.log(`[SSH] Creating ${dir} dir in workspace root`); | ||||
|   console.log(`[DIR] Creating ${dir} dir in workspace root`); | ||||
|   mkdirSync(dir); | ||||
|   console.log('✅ [SSH] dir created.'); | ||||
|   console.log('✅ [DIR] dir created.'); | ||||
| }; | ||||
| 
 | ||||
| const writeToFile = ({ dir, filename, content, isRequired }) => { | ||||
| @ -29,6 +29,7 @@ const writeToFile = ({ dir, filename, content, isRequired }) => { | ||||
|   } | ||||
| 
 | ||||
|   try { | ||||
|     console.log(`[FILE] writing ${filePath} file ...`, content.length); | ||||
|     writeFileSync(filePath, content, { | ||||
|       encoding: 'utf8', | ||||
|       mode: 0o600 | ||||
|  | ||||
| @ -8,7 +8,7 @@ const addSshKey = (content, filename) => { | ||||
|   const filePath = join(dir, filename); | ||||
| 
 | ||||
|   writeToFile({ dir, filename: 'known_hosts', content: '' }); | ||||
|   console.log('✅ [SSH] known_hosts file ensured', dir, filename, content); | ||||
|   console.log('✅ [SSH] known_hosts file ensured', dir, filename, content.length); | ||||
|   writeToFile({ dir, filename, content, isRequired: true }); | ||||
|   console.log('✅ [SSH] key added to `.ssh` dir ', dir); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dragan Filipovic
						Dragan Filipovic