Skip to content

Commit

Permalink
Allow non-SSL connection with timestamp service (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi authored Jan 23, 2025
1 parent 7ddd5e7 commit ecf6bae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"version": "0.1.0",
"engines": {
"node": "18.17.1",
"npm": ">=9.6.7",
"npm": "9.6.7",
"yarn": "~1.22.1"
},
"browserslist": [
Expand Down

0 comments on commit ecf6bae

Please sign in to comment.