# typed: true
class VpnOnlyRouteConstraint
  def matches?(request)
    if request.params[:force_vpn_off] == "1"
      false
    elsif Rails.env.test?
      true
    elsif Rails.env.development? || Rails.env.staging?
      request.ip == "127.0.0.1" || request.ip == "::1"
    elsif Rails.env.production?
      # curtus IP on vpn
      request.ip == "10.200.0.3"
    else
      false
    end
  end
end
