Skip to content
Snippets Groups Projects
Commit fa97b57a authored by bootstraponline's avatar bootstraponline
Browse files

Define default map as suggested on #460

Base path now sets a default map without having to use an external config.ru.
parent 1b952b6d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -413,7 +413,7 @@ By default, internal wiki links are all absolute from the root. To specify a dif
 
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
 
Note that base_path just modifies the links. To map gollum to a non-root location, use `map` in config.ru. See [#532](https://github.com/github/gollum/issues/532).
Note that base_path just modifies the links. To map gollum to a non-root location, use `map` in config.ru. See [#532](https://github.com/github/gollum/issues/532). `bin/gollum` now includes a simple map based on base path.
 
> :base_path - String base path for all Wiki links.
>
Loading
Loading
Loading
Loading
@@ -141,5 +141,31 @@ else
require cfg
end
 
Precious::App.run!(options)
base_path = wiki_options[:base_path]
if wiki_options[:base_path].nil?
Precious::App.run!(options)
else
require 'rack'
class MapGollum
def initialize base_path
@mg = Rack::Builder.new do
map '/' do
run Proc.new { [ 302, {'Location'=> "/#{base_path}" }, [] ] }
end
map "/#{base_path}" do
run Precious::App
end
end
end
def call(env)
@mg.call(env)
end
end
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port']).start
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment