Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
axsuul committed Dec 22, 2024
1 parent c016d37 commit 13a8f25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ ruby "3.2.2"
gem "http", "~> 5.1.1"
gem "prometheus-client", "~> 4.2.2"
gem "puma", "~> 6.4.0"
gem "rack", "~> 3.0.8"
gem "rack", "~> 3.0.8"
7 changes: 5 additions & 2 deletions lib/middleware/collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(app)
@plex_token = ENV["PLEX_TOKEN"]
@plex_timeout = ENV["PLEX_TIMEOUT"]&.to_i || 10
@plex_retries_count = ENV["PLEX_RETRIES_COUNT"]&.to_i || 0
@plex_ssl_verify = ENV['PLEX_SSL_VERIFY'] || "true"
@plex_ssl_verify = ENV["PLEX_SSL_VERIFY"] || "true"

# Metrics configs
@metrics_prefix = ENV["METRICS_PREFIX"] || "plex"
Expand Down Expand Up @@ -235,9 +235,12 @@ def send_plex_api_request(method:, endpoint:, **options)
loop do
url = "#{@plex_addr}#{endpoint}"

if @plex_ssl_verify != "true"
options[:ssl] = { verify_mode: OpenSSL::SSL::VERIFY_NONE }
end

log(method: method, url: url)

options[:ssl] = {verify_mode: OpenSSL::SSL::VERIFY_NONE} if @plex_ssl_verify != "true"
response = HTTP
.timeout(@plex_timeout)
.headers(
Expand Down

0 comments on commit 13a8f25

Please sign in to comment.