Commit 21e55ca318bb829399c85b10e678b596d6fd414e
1 parent
e9394c48
Exists in
master
and in
4 other branches
added RAILS_RELATIVE_URL_ROOT support
Showing
7 changed files
with
16 additions
and
7 deletions
Show diff stats
app/mailers/notify.rb
... | ... | @@ -6,6 +6,7 @@ class Notify < ActionMailer::Base |
6 | 6 | default_url_options[:host] = Gitlab.config.gitlab.host |
7 | 7 | default_url_options[:protocol] = Gitlab.config.gitlab.protocol |
8 | 8 | default_url_options[:port] = Gitlab.config.gitlab.port if Gitlab.config.gitlab_on_non_standard_port? |
9 | + default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root | |
9 | 10 | |
10 | 11 | default from: Gitlab.config.gitlab.email_from |
11 | 12 | ... | ... |
config.ru
config/gitlab.yml.example
... | ... | @@ -18,6 +18,9 @@ gitlab: |
18 | 18 | host: localhost |
19 | 19 | port: 80 |
20 | 20 | https: false |
21 | + # uncomment and customize to run in non-root path | |
22 | + # note that ENV['RAILS_RELATIVE_URL_ROOT'] in config/unicorn.rb may need to be changed | |
23 | + # relative_url_root: /gitlab | |
21 | 24 | |
22 | 25 | ## Email settings |
23 | 26 | # Email address used in the "From" field in mails sent by GitLab | ... | ... |
config/initializers/1_settings.rb
... | ... | @@ -25,7 +25,8 @@ class Settings < Settingslogic |
25 | 25 | [ gitlab.protocol, |
26 | 26 | "://", |
27 | 27 | gitlab.host, |
28 | - custom_port | |
28 | + custom_port, | |
29 | + gitlab.relative_url_root | |
29 | 30 | ].join('') |
30 | 31 | end |
31 | 32 | end |
... | ... | @@ -45,6 +46,7 @@ Settings.gitlab['default_projects_limit'] ||= 10 |
45 | 46 | Settings.gitlab['host'] ||= 'localhost' |
46 | 47 | Settings.gitlab['https'] ||= false |
47 | 48 | Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 |
49 | +Settings.gitlab['relative_url_root'] ||= '' | |
48 | 50 | Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" |
49 | 51 | Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}" |
50 | 52 | Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) | ... | ... |
config/routes.rb
... | ... | @@ -18,7 +18,7 @@ Gitlab::Application.routes.draw do |
18 | 18 | project_root: Gitlab.config.gitolite.repos_path, |
19 | 19 | upload_pack: Gitlab.config.gitolite.upload_pack, |
20 | 20 | receive_pack: Gitlab.config.gitolite.receive_pack |
21 | - }), at: '/:path', constraints: { path: /[-\/\w\.-]+\.git/ } | |
21 | + }), at: '/', constraints: lambda { |request| /[-\/\w\.-]+\.git/.match(request.path_info) } | |
22 | 22 | |
23 | 23 | # |
24 | 24 | # Help | ... | ... |
config/unicorn.rb.example
lib/gitlab/backend/grack_auth.rb
... | ... | @@ -17,10 +17,6 @@ module Grack |
17 | 17 | # Pass Gitolite update hook |
18 | 18 | ENV['GL_BYPASS_UPDATE_HOOK'] = "true" |
19 | 19 | |
20 | - # Need this patch due to the rails mount | |
21 | - @env['PATH_INFO'] = @request.path | |
22 | - @env['SCRIPT_NAME'] = "" | |
23 | - | |
24 | 20 | # Find project by PATH_INFO from env |
25 | 21 | if m = /^\/([\w\.\/-]+)\.git/.match(@request.path_info).to_a |
26 | 22 | self.project = Project.find_with_namespace(m.last) | ... | ... |