Commit 3899d07f authored by Bob Van Landuyt's avatar Bob Van Landuyt

Move hostname to Gitlab::Environment

parent 0fa94a0d
...@@ -222,7 +222,6 @@ Settings.gitlab['default_branch_protection'] ||= 2 ...@@ -222,7 +222,6 @@ Settings.gitlab['default_branch_protection'] ||= 2
Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil? Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil?
Settings.gitlab['host'] ||= ENV['GITLAB_HOST'] || 'localhost' Settings.gitlab['host'] ||= ENV['GITLAB_HOST'] || 'localhost'
Settings.gitlab['ssh_host'] ||= Settings.gitlab.host Settings.gitlab['ssh_host'] ||= Settings.gitlab.host
Settings.gitlab['hostname'] ||= ENV['HOSTNAME'] || Socket.gethostname
Settings.gitlab['https'] = false if Settings.gitlab['https'].nil? Settings.gitlab['https'] = false if Settings.gitlab['https'].nil?
Settings.gitlab['port'] ||= ENV['GITLAB_PORT'] || (Settings.gitlab.https ? 443 : 80) Settings.gitlab['port'] ||= ENV['GITLAB_PORT'] || (Settings.gitlab.https ? 443 : 80)
Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || '' Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || ''
......
module Gitlab
module Environment
def self.hostname
@hostname ||= ENV['HOSTNAME'] || Socket.gethostname
end
end
end
...@@ -31,7 +31,7 @@ module Gitlab ...@@ -31,7 +31,7 @@ module Gitlab
cached_circuitbreakers[storage] cached_circuitbreakers[storage]
end end
def initialize(storage, hostname = Gitlab.config.gitlab.hostname) def initialize(storage, hostname = Gitlab::Environment.hostname)
@storage = storage @storage = storage
@hostname = hostname @hostname = hostname
......
...@@ -64,7 +64,7 @@ feature "Admin Health Check", feature: true, broken_storage: true do ...@@ -64,7 +64,7 @@ feature "Admin Health Check", feature: true, broken_storage: true do
end end
it 'shows storage failure information' do it 'shows storage failure information' do
hostname = Gitlab.config.gitlab.hostname hostname = Gitlab::Environment.hostname
expect(page).to have_content('broken: failed storage access attempt on host:') expect(page).to have_content('broken: failed storage access attempt on host:')
expect(page).to have_content("#{hostname}: 1 of 10 failures.") expect(page).to have_content("#{hostname}: 1 of 10 failures.")
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::Git::Storage::CircuitBreaker, clean_gitlab_redis_shared_state: true, broken_storage: true do describe Gitlab::Git::Storage::CircuitBreaker, clean_gitlab_redis_shared_state: true, broken_storage: true do
let(:circuit_breaker) { described_class.new('default') } let(:circuit_breaker) { described_class.new('default') }
let(:hostname) { Gitlab.config.gitlab.hostname } let(:hostname) { Gitlab::Environment.hostname }
let(:cache_key) { "storage_accessible:default:#{hostname}" } let(:cache_key) { "storage_accessible:default:#{hostname}" }
def value_from_redis(name) def value_from_redis(name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment