diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-02-07 11:31:44 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-02-07 11:31:44 +0000 |
commit | 14bf5c10097a788b9971b7660c6104475fdc48fb (patch) | |
tree | 7ad67a85c61dec0a01602a4415eaeb435ae396f4 /config/initializers/1_settings.rb | |
parent | a7420b77bd9b7038af3702d3665faab317048d3a (diff) | |
parent | a965edb89d3c260394ffc987832a469e7740415d (diff) | |
download | gitlab-ce-14bf5c10097a788b9971b7660c6104475fdc48fb.tar.gz |
Merge branch 'master' into feature/gb/paginated-environments-api
* master: (301 commits)
added missed commit in rebase
update Grape routes to work with current version of Grape
adds changelog
fixes cursor issue on pipeline pagination
Use random group name to prevent conflicts
List all groups/projects for admins on explore pages
Fix indentation
More backport
Fix filtered search user autocomplete for gitlab instances that are hosted on a subdirectory
Fixed variables_controller_spec.rb test
Backport of the frontend view, including tests
Updated the #create action to render the show view in case of a form error
Improved code styling on the variables_controller_spec
Added tests for the variables controller #update action
Added a variable_controller_spec test to test for flash messages on the #create action
Modified redirection logic in the variables cont.
Added redirections to the index actions for the variables and triggers controllers
Added a flash message to the creation of triggers
Fixed tests, renamed files and methods
Changed the controller/route name to 'ci/cd' and renamed the corresponding files
...
Diffstat (limited to 'config/initializers/1_settings.rb')
-rw-r--r-- | config/initializers/1_settings.rb | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index ea61aa9e047..ab59394cb0c 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -6,7 +6,7 @@ class Settings < Settingslogic class << self def gitlab_on_standard_port? - gitlab.port.to_i == (gitlab.https ? 443 : 80) + on_standard_port?(gitlab) end def host_without_www(url) @@ -14,7 +14,7 @@ class Settings < Settingslogic end def build_gitlab_ci_url - if gitlab_on_standard_port? + if on_standard_port?(gitlab) custom_port = nil else custom_port = ":#{gitlab.port}" @@ -27,6 +27,10 @@ class Settings < Settingslogic ].join('') end + def build_pages_url + base_url(pages).join('') + end + def build_gitlab_shell_ssh_path_prefix user_host = "#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}" @@ -42,11 +46,11 @@ class Settings < Settingslogic end def build_base_gitlab_url - base_gitlab_url.join('') + base_url(gitlab).join('') end def build_gitlab_url - (base_gitlab_url + [gitlab.relative_url_root]).join('') + (base_url(gitlab) + [gitlab.relative_url_root]).join('') end # check that values in `current` (string or integer) is a contant in `modul`. @@ -74,15 +78,19 @@ class Settings < Settingslogic private - def base_gitlab_url - custom_port = gitlab_on_standard_port? ? nil : ":#{gitlab.port}" - [ gitlab.protocol, + def base_url(config) + custom_port = on_standard_port?(config) ? nil : ":#{config.port}" + [ config.protocol, "://", - gitlab.host, + config.host, custom_port ] end + def on_standard_port?(config) + config.port.to_i == (config.https ? 443 : 80) + end + # Extract the host part of the given +url+. def host(url) url = url.downcase @@ -255,6 +263,20 @@ Settings.registry['host_port'] ||= [Settings.registry['host'], Settings.regi Settings.registry['path'] = File.expand_path(Settings.registry['path'] || File.join(Settings.shared['path'], 'registry'), Rails.root) # +# Pages +# +Settings['pages'] ||= Settingslogic.new({}) +Settings.pages['enabled'] = false if Settings.pages['enabled'].nil? +Settings.pages['path'] = File.expand_path(Settings.pages['path'] || File.join(Settings.shared['path'], "pages"), Rails.root) +Settings.pages['https'] = false if Settings.pages['https'].nil? +Settings.pages['host'] ||= "example.com" +Settings.pages['port'] ||= Settings.pages.https ? 443 : 80 +Settings.pages['protocol'] ||= Settings.pages.https ? "https" : "http" +Settings.pages['url'] ||= Settings.send(:build_pages_url) +Settings.pages['external_http'] ||= false if Settings.pages['external_http'].nil? +Settings.pages['external_https'] ||= false if Settings.pages['external_https'].nil? + +# # Git LFS # Settings['lfs'] ||= Settingslogic.new({}) |