Skip to content

Commit

Permalink
Allow non-SSL connection with TimestampService
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi committed Jan 21, 2025
1 parent 7ddd5e7 commit 72a40f3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/services/timestamp_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 72a40f3

Please sign in to comment.