From 16a29d5afe9ba9269b60af83b495a4324a8643f1 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 29 Oct 2024 10:42:56 +1300 Subject: [PATCH] Allow overriding Rack adapter version. --- lib/protocol/rack/adapter.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/protocol/rack/adapter.rb b/lib/protocol/rack/adapter.rb index 944bc2c..119b55b 100644 --- a/lib/protocol/rack/adapter.rb +++ b/lib/protocol/rack/adapter.rb @@ -8,10 +8,12 @@ module Protocol module Rack module Adapter - if ::Rack.release >= "3.1" + VERSION = ENV.fetch("PROTOCOL_RACK_ADAPTER_VERSION", ::Rack.release) + + if VERSION >= "3.1" require_relative "adapter/rack31" IMPLEMENTATION = Rack31 - elsif ::Rack.release >= "3" + elsif VERSION >= "3" require_relative "adapter/rack3" IMPLEMENTATION = Rack3 else