This commit is contained in:
邱博亞 2024-05-09 07:56:25 +08:00
parent f3c6d82693
commit 21f9e32d0d
1 changed files with 1 additions and 1 deletions

View File

@ -152,7 +152,7 @@ namespace :create_site do
private_key_content = exec_ssh_command_by_sudo_and_see_output(ssh,"cat #{private_key_path}",false).select{|s| s.present?}.join("\n").strip.split(/(\r\n|\n)/).select{|s| s.present?}.join("\n") private_key_content = exec_ssh_command_by_sudo_and_see_output(ssh,"cat #{private_key_path}",false).select{|s| s.present?}.join("\n").strip.split(/(\r\n|\n)/).select{|s| s.present?}.join("\n")
FileUtils.mkdir_p(File.dirname(private_key_store_path)) unless Dir.exist?(File.dirname(private_key_store_path)) FileUtils.mkdir_p(File.dirname(private_key_store_path)) unless Dir.exist?(File.dirname(private_key_store_path))
File.open(private_key_store_path,'w+'){|f| f.write(private_key_content)} File.open(private_key_store_path,'w+'){|f| f.write(private_key_content)}
site_cert.private_key.retrieve_from_store!(File.basename(private_key_path)) site_cert.private_key.retrieve_from_store!(File.basename(private_key_store_path))
site_cert.source_paths = [crt_file_path,private_key_path] site_cert.source_paths = [crt_file_path,private_key_path]
site_cert.is_certbot = private_key_path.include?("letsencrypt") site_cert.is_certbot = private_key_path.include?("letsencrypt")
site_cert.save site_cert.save