Skip to content

Commit c016d37

Browse files
authored
Added PLEX_SSL_VERIFY env variable (#23)
1 parent c8e85b3 commit c016d37

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

Gemfile.lock

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ PLATFORMS
3232
aarch64-linux
3333
arm64-darwin-21
3434
x64-mingw-ucrt
35+
x86_64-linux
3536

3637
DEPENDENCIES
3738
http (~> 5.1.1)

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ These environment variables can be passed into the container (defaults are in pa
2121
- How long to wait for Plex Media Server to respond
2222
* `PLEX_RETRIES_COUNT` (`0`)
2323
- How many times to retry failed Plex Media Server requests
24+
* `PLEX_SSL_VERIFY` (`true`)
25+
- Whether to verify the SSL certificate when connecting with HTTPS
2426
* `METRICS_PREFIX` (`plex`)
2527
- What to prefix metric names with
2628
* `METRICS_MEDIA_COLLECTING_INTERVAL_SECONDS` (`300`)

lib/middleware/collector.rb

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def initialize(app)
1212
@plex_token = ENV["PLEX_TOKEN"]
1313
@plex_timeout = ENV["PLEX_TIMEOUT"]&.to_i || 10
1414
@plex_retries_count = ENV["PLEX_RETRIES_COUNT"]&.to_i || 0
15+
@plex_ssl_verify = ENV['PLEX_SSL_VERIFY'] || "true"
1516

1617
# Metrics configs
1718
@metrics_prefix = ENV["METRICS_PREFIX"] || "plex"
@@ -236,6 +237,7 @@ def send_plex_api_request(method:, endpoint:, **options)
236237

237238
log(method: method, url: url)
238239

240+
options[:ssl] = {verify_mode: OpenSSL::SSL::VERIFY_NONE} if @plex_ssl_verify != "true"
239241
response = HTTP
240242
.timeout(@plex_timeout)
241243
.headers(

0 commit comments

Comments
 (0)