From 72a40f3c54386d24bfb22a5e4a1241ca8197ad39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Tue, 21 Jan 2025 16:13:59 +0100 Subject: [PATCH] Allow non-SSL connection with TimestampService --- app/services/timestamp_service.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/services/timestamp_service.rb b/app/services/timestamp_service.rb index f055a9e576..658eae9e29 100644 --- a/app/services/timestamp_service.rb +++ b/app/services/timestamp_service.rb @@ -80,10 +80,18 @@ def timestamp_service_url Rails.application.secrets.timestamp_service_url end + def skip_ssl_verification? + Decidim::Env.new("TIMESTAMP_SERVICE_SKIP_SSL").present? + end + def timestamp_response return Time.current.to_s unless timestamp_service_url - resp = Faraday.post timestamp_service_url do |request| + connection = Faraday.new do |faraday| + faraday.ssl.verify = false if skip_ssl_verification? + end + + resp = connection.post(timestamp_service_url) do |request| request.headers["Content-Type"] = "text/xml" request.body = request_message end