Parse index key from hostname
My goal is to use the branch name as the subdomain, this is a step toward that.
This commit is contained in:
parent
6b53f583fd
commit
db209f50b5
|
@ -76,7 +76,7 @@ class Travis::Web::App
|
||||||
# route
|
# route
|
||||||
|
|
||||||
req = Rack::Request.new(env)
|
req = Rack::Request.new(env)
|
||||||
response_for("index.html", {params: req.params})
|
response_for("index.html", {params: req.params, host: req.host})
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -126,7 +126,10 @@ class Travis::Web::App
|
||||||
if index?(file)
|
if index?(file)
|
||||||
redis = Redis.new
|
redis = Redis.new
|
||||||
project = 'travis'
|
project = 'travis'
|
||||||
index_key = options[:params]["index_key"] || redis.get("#{project}:index:current")
|
|
||||||
|
host = options[:host]
|
||||||
|
|
||||||
|
index_key = host.split('.')[0] || redis.get("#{project}:index:current")
|
||||||
redis.get("#{project}:index:#{index_key}")
|
redis.get("#{project}:index:#{index_key}")
|
||||||
else
|
else
|
||||||
content = File.read(file)
|
content = File.read(file)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user