From dfb80470f6b86dc356734caaf384b4dd4e331655 Mon Sep 17 00:00:00 2001
From: Buck Doyle <buck@travis-ci.org>
Date: Thu, 14 Apr 2016 18:10:01 +0200
Subject: [PATCH] Add index key option for Redis front-end

---
 waiter/lib/travis/web/app.rb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/waiter/lib/travis/web/app.rb b/waiter/lib/travis/web/app.rb
index 88c04ad2..de6661fa 100644
--- a/waiter/lib/travis/web/app.rb
+++ b/waiter/lib/travis/web/app.rb
@@ -75,7 +75,8 @@ class Travis::Web::App
     # route[1]["Date"] = Time.now.httpdate
     # route
 
-    response_for("index.html")
+    req = Rack::Request.new(env)
+    response_for("index.html", {params: req.params})
   end
 
   private
@@ -92,7 +93,7 @@ class Travis::Web::App
     end
 
     def response_for(file, options = {})
-      content = content_for(file)
+      content = content_for(file, options)
       if fingerprinted?(file)
         headers = {
           'Content-Length'   => content.bytesize.to_s,
@@ -121,11 +122,11 @@ class Travis::Web::App
       [ 200, headers, [content] ]
     end
 
-    def content_for(file)
+    def content_for(file, options)
       if index?(file)
         redis = Redis.new
         project = 'travis'
-        index_key = redis.get("#{project}:index:current")
+        index_key = options[:params]["index_key"] || redis.get("#{project}:index:current")
         redis.get("#{project}:index:#{index_key}")
       else
         content = File.read(file)