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

Move hostname to Gitlab::Environment

parent 1a26174fbefe
......@@ -222,7 +222,6 @@ def cron_random_weekly_time
Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil?
Settings.gitlab['host'] ||= ENV['GITLAB_HOST'] || 'localhost'
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['port'] ||= ENV['GITLAB_PORT'] || (Settings.gitlab.https ? 443 : 80)
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 @@ def self.for_storage(storage)
cached_circuitbreakers[storage]
end
def initialize(storage, hostname = Gitlab.config.gitlab.hostname)
def initialize(storage, hostname = Gitlab::Environment.hostname)
@storage = storage
@hostname = hostname
......
......@@ -64,7 +64,7 @@
end
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("#{hostname}: 1 of 10 failures.")
......
......@@ -2,7 +2,7 @@
describe Gitlab::Git::Storage::CircuitBreaker, clean_gitlab_redis_shared_state: true, broken_storage: true do
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}" }
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